Semantic actions
Currently we need to write separate code to convert pest parsed representation to our own AST representation, as shown in JSON example. The drawback of that approach is that you have to keep that conversion in sync with grammar, as they are in different places. Bison have semantic actions and peg crate also supports them (see a:e1 b:e2 c:e3 { rust }). It allows to get you own AST type right after parsing and you can change AST construction steps right when you change your grammar, no need to separate conversion step, you can even avoid creating intermidiate parser-related values (Pair) and just immidiately produce user defined types while parsing
The vision for pest3 is much closer to this. So far we've seen value in not embedding actions into the grammar itself; this means that the grammar is an actual formal definition of the grammar you're parsing (as opposed to, say, ANTLR, where you can arbitrarily add conditions/effects to the grammar).
Pest3 intends to bring a system where instead of creating the pair-based tree, we create a "Listener"-like interface that you implement that determines what is used to "reduce" a tree from the "actions" the parser parses.
I have written a crate that provides something like that with the current version of pest: https://docs.rs/pest_consume. I've been using it in a large parser and it works very smoothly. Check out the csv example if you're curious. @fan-tom you might be interested if you don't want to wait for pest3 @CAD97 I'd be interested to discuss how that would fit with pest3 and how the listener approach would work in practice
@CAD97 Is the work for pest3 is progress? Excited about this feature. I have recently went through the boo. Loved the simplicity of pest :)
Unfortunately, @dragostis hasn't been able to work on pest recently, and basically everything pest3 related is blocked on him. I can merge fixes and dependency updates to this repository, but I can't actually publish, so the project is basically on hiatus while @dragostis is busy.
Might be a good idea to share publishing rights as this just holds development back ;)