I would like to write simple parser in Perl that mainly provide an additional layer over an existing language. I was looking at Parse::Yapp
, Parse::Lex
or even Marpa::R2
, but the only concrete example is always the same: a simple calculator that does 43 * 8 + 1
. I cannot easily find any other examples so I am wondering if these packages are still a good choice to implement a parser.
Are Parse::Yapp
, Parse::Lex
or Marpa::R2
still a good solution over a hand-rolled approach?
Where can I find more examples and documentation on these modules? The CPAN pages are usually pretty empty
For small simple parser jobs like this sort of thing, I wrote Parser::MGC
. Your particular case of numerical expression evaluation is likely some variant of one of the examples, namely
https://metacpan.org/source/PEVANS/Parser-MGC-0.13/examples/eval-expr.pl
Marpa::R2 is in heavy and increasing use. IBM advertises their use of it: https://www.ibm.com/developerworks/community/blogs/jalvord/entry/sitworld_itm_situation_audit?lang=en Metacpan lists ~30 direct dependences and there are indirect dependences from those. There are open-source C, ECMAScript parsers. There's more stuff listed on the web site: http://savage.net.au/Marpa.html#Applications
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With