[antlr-interest] hierarchy of lexers and parsers

Thierry Frey tfrey at publimation.com
Thu Aug 11 06:13:39 PDT 2005


I've just started using ANTLR and I have a question I hope can be answered
on the list.

My input is a string which contains some tags (anything within angle
brackets) and some logic code (anything within square brackets) embedded in
regular text. I would like to have a primary lexer that recognizes three
token types: TEXT, TAG and CODE. When the primary parser encounters a token
of type CODE while generating the AST, I would like it to pass that token to
a secondary (lexer,parser) pair that will be in charge of building the

I believe this can be achieved by using token streams but so far, I haven't
found a convenient solution.

Thanks in advance,

More information about the antlr-interest mailing list