[antlr-interest] Abstract syntax tree

Marcel Cerveny mcerveny at gmail.com
Thu Feb 24 07:20:19 PST 2005


> The best way to start is to read the manual
Good to know. I started to read it. Thanx Bryan!

However, I'd like to know beforehand if it is possible to name the
nodes in such way that I can access them in a readable way. For
instance, having a file of shape
public interface ITest {
int a = 1;
...
}

also having the parser spec something like:
interf : (scope) I_IDENT! IDENTIFIER^ (body) ;
scope : ( { ## = #[NO_SCOPE]; } | PUBLIC | PRIVATE ) ;
body : ...

is there a way how to do manipulate it as
interf.scope.getText(); // returning for example "public"
instead of
parseTree.getFirstChild().getText(); ?

The structure will quite shallow, thus it might be handy. I'll be
happy even if anybody will tel me "it is possible." I can later find
it in manual.
Of course giving concrete hint would be even better...

Thanx in advance

Marcel


More information about the antlr-interest mailing list