[antlr-interest] Force nodes for grammar rules

Maik Merten maikmerten at gmx.net
Mon Dec 5 13:09:59 PST 2005


Hello,

I know that ANTLR generates abstract syntax trees and doesn't include
nodes for every grammar-rule applied. This is discussed in the FAQ (
http://www.jguru.com/faq/view.jsp?EID=814505 ) and this behaviour is a
Good Thing(tm).

However, for the project i am involved with it is considered extremely
handy to have the actual parse tree (there may be cases where the exact
sequence of productions gives information about the "context" - which we
could exploit instead of doing more extensive analysis).

I may be cursed with blindness but I am not aware of a way to force the
parse tree into the "AST" tree. Is there any? Can we modify the grammar
in a way that ensures that every rule applied gets a node?


Thank you,

Maik


More information about the antlr-interest mailing list