[antlr-interest] implementing C-style #define macros in ANTLR
    Jim Idle 
    jimi at temporal-wave.com
       
    Wed Mar 25 08:40:49 PDT 2009
    
    
  
Bruce Bauman wrote:
> I am trying to convert 4 million lines of Pascal code from the MetaWare Pascal compiler to Free Pascal. (yes, really). Unfortunately, MetaWare Pascal supports many non-standard extensions to Pascal, including C-style macros. Our existing Pascal code base uses the macro feature extensively..
>  
> Any suggestions on how to implement this? Any examples in existing ANTL grammars?
>  
If Free Pascal does not support macros, then you will need to implement 
a macro processor of course, but if the style is very C like then it is 
pretty certain that you can implement this in m4 without too much 
messing around. A full blown macro processor is a bit of a pain to write 
anyway, but with something like ANTLR it can get a bit messy and 
difficult to maintain.
If you mean implement the Pascal Parser, then if there is not already a 
grammar for MetaWare Pascal, you will have to write it of course ;-)
Jim
    
    
More information about the antlr-interest
mailing list