[antlr-interest] Antlr grammer for C preprocessor

Weixian Shen weixian_shen at hotmail.com
Tue Apr 10 14:51:58 PDT 2007


Hi,I am planning to implement a "specialized" C preprocessor using Antlr. The C preprocessor should not be limited to processing C source file only, and does not need to build tokens to pass to C compiler. It only need to 1) strip comment blocks 2) handle back-slash newline sequence 3) understand C preprocessor directives, macros, and builds an AST tree. Only C preprocessor directives need to be included in the tree node. Non-preprocessor related stuff such as C code can be ignored.I tried to start from the C preprocessor example done by "Youngki KU" but it doesn't seem to compile (with antlr 3.0 or 2.77). Is there any full-fledged project based on antlr for C preprocessor I can take a look at? If not, is there a full-fledged grammer files that works with antlr 2.77 (preferred) or 3.0? I was able to build a very basic preprocessor but I am having difficulty processing macro, string contact, etc.Vincent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070410/af760c67/attachment.html 


More information about the antlr-interest mailing list