[antlr-interest] 2 flex lexers 2 antlr parsers -> 1 simple solution?

elias_biris user_sofia at biris.freeserve.co.uk
Tue Nov 5 05:20:14 PST 2002


Hi,

I am having a go at learning antlr, and I am interested in the
flexLexer example that appears in the latest source tarball. What I
would like to know is how could one put together 2 lexers, generated
by flex and corresponding to 2 input streams that are multiplexed? I
already understand how an antlr generated parser for language A can
call the parser of language B, upon finding the initial condition that
triggers recognition to switch to 'the other' language of the 2 ...
it's the lexers that puzzle me.

Specifically, I am puzzled with the input state of the flex lexers. In
the multipleLexer example it is  shown that  using the Antlr generated
lexers such multiplexing of lexers is possible via attachment of the 2
lexers to the same shared input.... However using flex lexers there
are no  Lexer objects (only token-stream wrappers), and there is no
way to get the two token stream wrappers to share input state (they
don't have any)...

I am rather new to the idea of multiplexing, so if anyone has an idea
on how it is possible to multiplex lexers generated by flex, or
pointers for more information, please let me know.

All the best

Elias Biris


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list