5 ms·
PEGs: Parsing Expression Grammars
- vog 15y agoIt should be mentioned that this paper is from 2004, and that in the meantime there's even a Wikipedia article about PEG: http://en.wikipedia.org/wiki/Parsing_expression_grammar http://en.wikipedia.org/wiki/Parsing_expression_grammar
- Homunculiheaded 15y agoI read this paper not long ago as it was referenced in Ward Cunningham's interesting work in Exploratory Parsing [0]. It's a quick read and definitely interesting. If you're interested there's a yacc equivalent peg/leg [1]. The only thing that wasn't clear to me (and I'd appreciate enlightenment if anyone has any) is why Cunningham's Exploratory Parsing depends so much on PEGs? Is it simply the non-ambiguous nature of the parse tree? 0. http://c2.com/~ward/sao/TechIgnite-v1/ http://c2.com/~ward/sao/TechIgnite-v1/ 1. http://piumarta.com/software/peg/ http://piumarta.com/software/peg/
- oscilloscope 15y agoPEG.js has an online grammar creator: http://pegjs.majda.cz/online http://pegjs.majda.cz/online
- loup-vaillant 15y agoI have to mention OMeta, a language based on PEGs (plus a few extensions): http://www.tinlizzie.org/ometa/ http://www.tinlizzie.org/ometa/ It's dead simple, and quite powerful: it helps implement all compilation phases, from parsing to code generation. And it compiles itself in about 400 lines of code.
- DanielRibeiro 15y agoThere are some great PEG parsers in Ruby: * Parslet: http://kschiess.github.com/parslet/ http://kschiess.github.com/parslet/ * Treetop: http://kschiess.github.com/parslet/ http://kschiess.github.com/parslet/
- demallien 15y agoTreetop is great - I have previously written parsers using yacc and lex, and I found treetop to be around about 2 orders of magnitude more productive. That said, I don't know that I would want to use it on large files with a complex grammar :/