[antlr-interest] Lexical hacks ... again.

g4 at novadsp.com g4 at novadsp.com
Sun Feb 27 06:40:30 PST 2011


Right. ANTLR != PCCTS. Wow.

I've written a modest utility to transform CoCo/R grammar specs to ANTLR 
3. CoCo/R allows syntactic predicates (for LL(1) disambiguation) to be 
embedded as 'IF' '(' anything ')'. Not wanting to parse all the code 
I've dealt with this by having the lexer eat all content after spotting 
the 'IF'.

Question is this: Is there any way to embed a 'sub-lexer' at this point? 
i.e. grab the input stream and point it at a lexer for C#/C code?

I don't need to evaluate the expression itself but storing lexical 
tokens rather than characters would be a plus in later stages of analysis.

Thx++

Jerry.




More information about the antlr-interest mailing list