[antlr-interest] hierarchy of lexers and parsers

Andrew Deren andrew at adersoftware.com
Thu Aug 11 13:26:18 PDT 2005


I've done something similar to what you need (but used # for starting
expression), but it was a hand coded lexer and parsers. 
It's part of my code templates open source project. You can download it from
http://www.adersoftware.com/index.cfm?page=templateEngine2

Andrew

-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Thierry Frey
Sent: Thursday, August 11, 2005 8:14 AM
To: antlr-interest at antlr.org
Subject: [antlr-interest] hierarchy of lexers and parsers

Hello,

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
(sub)AST.

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

Thanks in advance,
Thierry
  





More information about the antlr-interest mailing list