Sunday, July 23, 2006

July 23rd, 2006 -- Pugs::Emitter::Rule::Parsec

I finally escaped from the final exams and projects, and the unexpected busy early July. The first checkin of the Pugs::Emitter::Rule::Parsec module is on July 20th. It accepted and emitted correct Haskell code on the yada example given in the README of MiniPerl6 module. (By the way, the Pugs::Grammar::MiniPerl6 and Pugs::Compiler::Rule modules have been moved from pX/ to perl5/)

After three days' hacking, it now accepts a lot of rule constructions. Also, a test file was added. In Parser.Literal there are 10 parser routines, two of them take arguments (namedLiteral and possiblyTypeLiteral) which I currently don't know how to present in Perl 6 rule, one uses previous parsing state to decide next action (ruleWordboundary), two use negative look-ahead (ruleDot and ruleLongDot) but <!before pattern> is not ready yet, all other five can be easily generated. In fact, all five of them are already in the test file, the result is tested by replacing existing code by the generated one proven that it gears Pugs' parser, too.

UPDATE: <!before pattern> support is added to both Pugs::Compiler::Rule and Parsec emitter. However, since the existing parser is not LL, I have to put an additional "try" in the generated code by hand to make it work.


Post a Comment

Links to this post:

Create a Link

<< Home