[antlr-interest] How to get information on the tokens that produced a tree node?

Gonzague Reydet gonzague.reydet at gmail.com
Fri Dec 16 02:27:21 PST 2011

Hi all,

I am working on a lexer & parser grammar that produce an AST from an input
file. The AST is then passed to a tree grammar that calls my custom code. I
think it is a classic ANTLR pattern, isn't it?
When an error is detected during the tree parsing, I am looking for a way
to print error with information on the original input tokens, not on the
tree node which is not relevant for the end user.
How to get information on the origin input file from the display error
function of the tree grammar? Is there a link between the tree node stream
of the AST and the token stream produced by the lexer?

Note that my target language is C.


More information about the antlr-interest mailing list