This is not an exact answer to your question, but a possible direction to
take for solving your problem.

I would suggest looking at the AST from the parser using ToTokenString() and
ToStringTree().

ToTokenString() will print the AST as a stream of tokens, with DOWN and UP
tokens noted in the error message.
ToStringTree() will print the AST using nested ( ), and is more human
readable.
Since these are two different perspectives of the same AST, by comparing
them you will soon notice that DOWN corresponds to ( and UP corresponds to
).

*pseudo code* for the conversions.

Parser parser = new Parser(nodes);
Paser.startrule_return  parseResult = parser.startrule();

CommonTree ast = ((CommonTree)parseResult.Tree);

CommonTreeNodeStream astTokens= new CommonTreeNodeStream (new
CommonTreeAdaptor(), ast);
Print(astTokens.ToTokenString());

Print( ((CommonTree)ast).ToStringTree() );

If you plan on spending more than a few days on this, I would strongly
recommend getting "The Definitive ANTLR Reference" and possibly "Language
Implementation Patterns" by Ter.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to