[antlr-interest] AST generation: EXPRESSION TREE example.

Tom Verbeure hombre at gmail.com
Thu Jun 3 08:44:37 PDT 2004


Hi Bharath,

> Thank you very much. Are you generating an abstract syntax tree for your
> grammar, yet? I would like to know what drives your AST structure. What do
> you need it for?

I've only just started working on it and it's going slowly. One
(trivial) thing I didn't realize up front, was that, without any
annotations, the AST tree is simply a list of all the original tokens.
I found it very useful to add

System.out.println(parser.getAST()).toStringList());

to get an idea about what was generated after building the AST.

I add a quite number of non-token nodes to tree to make tree parsing
as simple as possible. Other than that, I can't give you much useful
information. Right now, it's quite an interative process.

Tom


 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
     http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
     antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
     http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list