| Module Info
| Add a review of Parse-Yapp
It took me some time to get to grips with the syntax to use with Yapp, but following the examples is definitely the easiest way to go. Once you've learnt how to use this module you can achieve very effective results with a minimum of effort.
You can optionally compile Parse::Yapp into your generated module to make a "Standalone Parser". If you use more than one standalone parser you get lots of redefined warnings related to the embedded Driver module.
Otherwise an excellent module that does what it does with the minimum of fuss.
Parse::Yapp was my favourite module for parsing.
True, it lacks named access to semantic rules values
and other nice features that Parse::RecDescent (my second
favourite module for parsing) provides.
This is one of the reasons I wrote an extension of Parse::Yapp named 'Parse::Eyapp'. Any program that runs on Parse::Yapp works without changing a comma on Parse::Eyapp. Parse::Eyapp also provides extensions similar to the ones you can find in Parse::RecDescent. For example, using the directive %defaultaction works as the "autoactions" in Parse::RecDescent.
I tried to merge the many beautiful features of Yapp and RecDescent.
And add a few more. If you like these two modules, give a try to Parse::Eyapp.
Come on, hand it to this author.
You must know that yacc is one of the glowing accomplishments of the computer age, and here is an excellent perl implementation. It even parses its own syntax (as such an application should).
Granted, the "documentation" is a bit scant, but between Calc.yp and YappParse.yp, and a couple of hours of quality hacking, you can get all the info you need.
Roll your sleeves up, tweak the _Lexer, write a couple of languages, and see your object code generated!
My hat's off to you, Francois.
The documentation of this module can definitely be improved. Even bison documenation would not be of help in some situations (after all, bison is in C). Once user found out how to use it, it is clear that this module is easy to use (still not nearly as easy as Parse::RecDescent since you'd have to provide a lexer function, or tokenizer), powerful, compatible with other YACC-based parser generators. But the most conspicuous advantage of this module is its parser's speed. Much much faster than Parse::RecDescent when dealing with long input.
However, in the end, based ONLY on my experience, I would not recommend using this module in most situations. That is because for situations where performance is no issue, Parse::RecDescent should be used. When performance is needed, Perl-byacc should be used. The only situation where Parse::Yapp should be used is on the OSes where perl-byacc is not available like Windows.
Note that one criticism against perl-byacc is that its parser is not OO, but one could fake a OO parser simply by adding a global variable $self (or use patches for older version 1.8 or newer version 2.0). In my experience, perl-byacc parser was twice as fast as one based on Parse::Yapp when using the same grammar and essentially the same lexer.
I made a detailed comparison, usage example of Parse::RecDescent, Parse::Yapp, and Perl-byacc during my Entrez Gene parser project at sourceforge.net/docman/display_doc.ph...
I started using Parse::RecDescent, which is very convenient, but it ended up being too slow for my needs. Parse::Yapp is way, way faster. Writing the grammar may have been a little bit harder, but it was worth it.
I didn't have familiarity with yacc/bison, which is handy when using this module because the documentation often just says "it works like bison". But after looking at the bison docs, everything became more clear.
Parse::Yapp is a perl clone of Unix LALR parsers. As such it is not
as versatile as Parse::RecDescent but it is way faster.
Too bad there is no named access to semantic rules values.