"Daniel Gibson" <metalcae...@gmail.com> wrote in message news:io8u12$132q$1...@digitalmars.com... > Am 15.04.2011 09:50, schrieb Nick Sabalausky: >> Since you're talking about C, you'll probably want to run your original C >> code through the "preprocess-only" option of a real C compiler. (I >> *think* >> DMC will do that.) Then parse the resulting "preprocessed C" files with >> Goldie. (Although if your goal is an HTOD-like tool, maybe you would need >> to >> deal with the original un-preprocessed source directly. > > Why? Just call the preprocessor from your tool or from a wrapping script > and go on with the preprocessed C code. Should be much easier and more > compatible because C compilers ought to know how to preprocess correctly. > For GCC the option you're looking for is "-E", btw. >
If by "your tool" mean a program that uses Goldie to process C code, then yea, that's what I meant. If you meant that Goldie should invoke a C preprocessor directly, that's a bit tricky: Goldie is a generalized parsing tool (sort of like ANTLR or Spirit), so it doesn't really know "Ok, this is supposed to be C". It just parses according to whatever grammar it's given. Of course, it's not entirely out of the question to have some sort of system for specifying that a source should have XYZ tool (such as "C preprocessor") invoked on it first, etc, but it's probably easiest if programs using Goldie just invoke whatever other tools they need by themselves. (Sorry if I've stil misunderstood - it's late over here ;) )