Related articles |
---|
Looking for simple C Preprocessor source jmensch@home.com (Julian Mensch) (2002-06-20) |
Re: Looking for simple C Preprocessor source Marko.Makela@HUT.FI (Marko =?ISO-8859-1?Q?M=E4kel=E4?=) (2002-06-28) |
Re: Looking for simple C Preprocessor source remove@matematik.su.se (Hans Aberg) (2002-06-28) |
Re: Looking for simple C Preprocessor source nmh@t3x.org (Nils M Holm) (2002-06-28) |
Re: Looking for simple C Preprocessor source kratkin@yahoo.com (Niktar Lirik) (2002-06-28) |
Re: Looking for simple C Preprocessor source parsersinc@yahoo.com (SLK Parsers) (2002-07-04) |
Re: Looking for simple C Preprocessor source dickey@Radix.Net (Thomas Dickey) (2002-07-15) |
[1 later articles] |
From: | "Julian Mensch" <jmensch@home.com> |
Newsgroups: | comp.compilers |
Date: | 20 Jun 2002 21:50:10 -0400 |
Organization: | Shaw Residential Internet |
Keywords: | C, macros, question |
Posted-Date: | 20 Jun 2002 21:50:10 EDT |
Hi. I'm writing a computer game that has it's own scripting and
level definition language, created with FLEX and ACCENT. Now, because
the language requires so many constants shared with the main game in
C++, I run it through the C preprocessor to allow me to use include
files and defines before using my own level compiler on it.
Problem: my language contains '#' symbols, large fields of symbols
that aren't supposed to be interpreted the way C would and other
differences that tend to choke the preprocessor. So I need to find the
source code for a _simple_ C preprocessor, preferably one someone made
as a hobby project, so that I can hack it into a suitable preprocessor
for my own project.
All it needs to have is #include and #define (for constants, not
macros) though the conditional compilation and macro support would be
useful. But the source needs to be relatively compre- hensible so I
can change it, and reasonably short (say, < 100k). I don't want to
try and learn to understand the GCC source for this mickey mouse kind
of hack. Obviously, I could write this myself, but it's a fair amount
of work and I'd rather not "reinvent the wheel" in this circumstance.
I found 'P', the Small C Preprocessor from Dr. Dobbs, but it's
written in _small_ C, which means that A) it won't compile in normal C
on my machine due to Small-C wierdness, and B) it has implemented a
symbol table without structs (Small-C doesn't have structs), making
the source nearly unintelligable. So this option is ruled out.
Can anybody help?
-- Julian Mensch
[If you just want something for your own use, a simple preprocessor with
include and define is a few dozen lines of perl. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.