Hi, For the last few years I've been working on extending PEG notation in a way such that it is easy to infer the parsing algorithm and an appropriate abstract syntax tree for storing the language both from a single grammar description. I've called this notation and the rules it uses to infer the AST "Tree-building parsing expression grammars."
The chilon::parser library implements the TBPEG concept using template-meta-programming in C++0x. It is able to build the AST type at compile time and then populate this AST based on an input source at run-time. You can get the chilon::parser code and a paper on TBPEGs at http://chilon.net/library.html This site also contains a pretty in depth tutorial with many examples. As a quick example to show how concise chilon::parser can be, I was able to create a parser for the TBPEG grammar that stores a very neat AST in less than 50 lines of code. I'm currently working on extending things a lot further, expect a lot of cool future developments... current project is writing a parser generator using TBPEG notation that outputs chilon::parser expressions. Since there is a one to one mapping from TBPEG rules to chilon::parser rules the code it produces will map very cleanly to/from the source grammar. Cheers, James -- ja...@chilon.net _______________________________________________ PEG mailing list PEG@lists.csail.mit.edu https://lists.csail.mit.edu/mailman/listinfo/peg