[antlr-interest] Using ANTLR 3.1 to parse macros (for a Macro Assembler)

Wayne Venables wayne at codaris.com
Tue Sep 30 20:54:49 PDT 2008


Hello Everyone,

I'm working on a macro assembler for an embedded platform (trying to 
improve on the existing DOS-based assembler).  I'm new to ANTLR3 and I've 
been trying to figure out how to handle the assembler macros.  They work 
like C pre-processor handles #define's -- it's just text substitution.  I 
believe I understand how the old C pre-processor example works:

	http://www.antlr.org/share/1090897436819/cpp.g

but that was designed for the older version of ANTLR and I haven't figured 
out how translate that example into ANTLR3.  In ANTLR3, how do I get the 
parser to switch to a new lexer in the middle of the processing and then 
retry the match?  Or is there a different/better way of handling this in 
ANTLR3?   I'm using the CSharp target.  So far I haven't had any luck with 
the book, the online manuals, or google.

Thanks,



More information about the antlr-interest mailing list