August 15th, 2006 -- Last Day of SoC
In fact, this is a post for 8/14. I worked until three o'clock this morning.
Since fglock++ worked a lot on changing Pugs::Rule::Compiler to make module v6 better, I also made some changes to make my existing code work after the merge from pX/ to perl5/. After that, since most parts of Literal.hs are in the test file of the Parsec emitting module, I began writing the translation tool.
It is now here, with the Literal.grammar added. Since parameter of rules is not supported, three of them are still written in Haskell after the "use Haskell" statement. Beside that, a patch file is included which make the generated file really work.
The reasons of needing a patch file are: non-LL grammar which need backtrack and a weird error message without type annotation. There are three places where "try" is added in the generated source to allow backtrack, they can be avoid by rewriting the grammar.
But the need of annotation is not clear to me. The original parser is like this:
Since fglock++ worked a lot on changing Pugs::Rule::Compiler to make module v6 better, I also made some changes to make my existing code work after the merge from pX/ to perl5/. After that, since most parts of Literal.hs are in the test file of the Parsec emitting module, I began writing the translation tool.
It is now here, with the Literal.grammar added. Since parameter of rules is not supported, three of them are still written in Haskell after the "use Haskell" statement. Beside that, a patch file is included which make the generated file really work.
The reasons of needing a patch file are: non-LL grammar which need backtrack and a weird error message without type annotation. There are three places where "try" is added in the generated source to allow backtrack, they can be avoid by rewriting the grammar.
But the need of annotation is not clear to me. The original parser is like this:
ruleTwigil :: RuleParser StringAnd the generated version is (ugly and obviously not hand-written)
ruleTwigil = option "" . choice . map string $ words " ^ * ? . ! + ; "
ruleTwigil = option "" $ doWithout type annotanion, both version of code cause the error
string "^"
<|>
string "*"
<|>
string "?"
<|>
string "."
<|>
string "!"
<|>
string "+"
<|>
string ";"
No instance for (MonadState RuleState (GenParser Char st))Any comment?