[antlr-interest] is there any standard tree?

Markus Kuhla bace.spam at gmx.net
Thu Jun 7 09:38:19 PDT 2007


Is this too simple or too stupid? Don't hesitate to answer ;)

cheers

> Hi,
> 
> 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);
> nodes.setTokenStream(tokens);
> 
> 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
-- 
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten 
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser


More information about the antlr-interest mailing list