[antlr-interest] is there any standard tree?

Markus Kuhla bace.spam at gmx.net
Wed Jun 6 11:16:15 PDT 2007


I want to get the AST from the parser. I set the option "output=AST;" and saved the return object from the parser.

Now I would like to walk (DFS) through the tree. But using the getChild(i) method gives me only the tokens of the leafs. Where are the other nodes between root and leafs? I also tried:
CommonTreeNodeStream nodes = new CommonTreeNodeStream(tree);

But nodes.toString() also returns only the tokens. Is there any way to get the entire AST, without writing a new grammar for a tree walker?

Thank you very much for any reply !!!
Best, Markus
Psssst! Schon vom neuen GMX MultiMessenger gehört?
Der kanns mit allen: http://www.gmx.net/de/go/multimessenger

More information about the antlr-interest mailing list