I’m using ANTLR 3 to create an AST. I want to have two AST analysers, one to use in production code and one to use in the Eclipse plugin we already have. However, the plugin doesn’t require all information in the tree. What I’m looking for is a way to parse the tree without specifying all branches in the grammar. Is there a way to do so?
Share
You may have figured this out already, but I’ve used
.or.*in my tree grammars to skip either a given node or any number of nodes.For example, I have a DSL that allows function declarations, and one of my tree grammars just cares about names and arguments, but not the contents (which could be arbitrarily long). I skip the processing of the code block using
.*as a placeholder:I don’t know about the runtime performance hit, if any, but I’m not using this construct in any areas where performance is an issue for my application.