You might want to have a look at Metalua's gg.lua library (https://github.com/fab13n/metalua/blob/master/src/compiler/gg.lua). It's a parser combinator system rather than a PEG, but it focuses on AST production, ability to produce decent error messages on incorrect inputs (very important for programming languages), and dynamic extensibility (you probably don't care about the latter).
The use of gg is detailed in Metalua's manual; you can also look at src/compiler/mlp_*.lua files for inspiration.
On Thu, Mar 31, 2011 at 10:39 AM, Lode Hoste <zillode@zillode.be> wrote:
Hi,
After watching the talk about LPeg I was inspired to use it to describe the grammar of my DSL [but]
I can't find a good pointer on how to generate an AST or parse tree with callbacks from it.