Thoughts on heterogeneous tree construction in ANTLR4

Skip to end of sidebar
Go to start of sidebar
Skip to end of metadata
Go to start of metadata

In Squirrel away the trees, call on the visitors Terence describes how you can add actions without putting them into the grammar file. This really sounds like a cool idea, but sometimes you might want to have an AST. What I would like to see is support from ANTLR 4 to generate heterogeneous, non normalized trees.    

Example of syntax for that - based on syntax for homogeneous tree construction:

You would then have to supply matching AST classes:

... and walk them using whichever technique you like - no need for further ANTLR support here.

Labels: