[antlr-interest] C++ parser usage ideas

Paul Johnson gt54-antlr at cyconix.com
Thu Oct 13 07:07:07 PDT 2005


Jim Crafton wrote:
> I need something that's a library, not something driving a process
> (i.e. I don't want to drice a "cpp" process, if I could use it as a
> library that would be ideal). Plus I thought when I looked before that
> cpp (if it's the one I'm thinking of) is GPL'd?
> 
> I do have a pre-processor lib. It would appear that the only "glitch"
> with it, is that it doesn't seem to put in the "#line XXX" notation
> (or I haven't figured out how to enable that part of it).

My code's a library. I build a string that looks like

"cpp user_file_name temp_file_name extra_cpp_options -nostdinc"

and then I 'system' it (on Unix), and compile the resulting 
temp_file_name. I can't see any way around that - if the user expects to 
  use the system C preprocessor, then I think you have to do exactly the 
same. I don't know about cpp's licensing - as far as I'm concerned, I'm 
just running the program.

That said, I'm not really sure that an IDE should be preprocessing code 
anyway. Does the IDE need to know about #include files?

Paul



More information about the antlr-interest mailing list