[antlr-interest] Switching between different lexers from within parser
Helmut Neukirchen
neukirchen at itm.mu-luebeck.de
Wed Jan 23 08:30:25 PST 2002
Hi folks,
is there a possibility to switch in a clean and deterministic way
beetween different lexers from within the *parser*?
In contrast to the Javadoc example, where switching between different
lexers is done from within the lexers, I have to deal with a language
where this is only possible from within the parser.
(Think e.g. of C with embedded SQL, but without the leading "EXEC SQL"
which usually introduces each statement of embedded SQL.)
In my language, the parser is the only instance which is able to decide
which lexer has to be chosen next. On the other hand, due to the look-ahead
and the loose coupling between parser and lexers through the token stream,
the wrong lexer might already have scanned and consumed characters which
were in fact intended for the other lexer.
Any ideas?
Thanks,
Helmut
--
Helmut Neukirchen mailto:neukirchen at itm.mu-luebeck.de
Institute for Telematics http://www.itm.mu-luebeck.de
Medical University of Luebeck phone: +49 451 500 4867
Ratzeburger Allee 160, D-23538 Luebeck, Germany fax: +49 451 500 3722
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list