Piggy
Piggy copied to clipboard
Listener vs Visitor patterns
Antlr has both a visitor and listener pattern implementation. See https://saumitra.me/blog/antlr4-visitor-vs-listener-pattern/ . Piggy needs a similar pattern with syntax. At the moment, Piggy patterns are visitor patterns, in which once matched in a pass, the node and entire sub-tree eliminated from further pattern matching.
This is very important. I want to special case special cases for parameters of functions. I can do special case a parameter--but only by special casing the match for the entire function declaration. What I want is to add in a pattern specific for the parameter without adding in a whole new pattern for functions.