|C Preprocessor email@example.com (2002-03-19)|
|Re: C Preprocessor firstname.lastname@example.org (Randall Hyde) (2002-03-21)|
|Re: C Preprocessor email@example.com (Math Stuff) (2002-04-17)|
|C Preprocessor Mark_Kuschnir@gec-epl.co.uk (1993-04-26)|
|From:||"Math Stuff" <firstname.lastname@example.org>|
|Date:||17 Apr 2002 23:21:13 -0400|
|Organization:||Posted via Supernews, http://www.supernews.com|
|Posted-Date:||17 Apr 2002 23:21:13 EDT|
I'm sure there are more efficient methods than this, however, it
worked. A few years ago I wrote a preprocessor for the basic
language. It supported all of the same features of the C preprocessor
including macros. What I did was write a temp file for each macro as
I encountered its definition and then changed the input stream when I
encountered the macro in the code.
> is someone can help me with the logic of the "functional macros" ?
> I have few ideas but I want to polish them...
[That's what you do, except that the temp files are strings in memory
rather than actual files. You keep a stack of which macro you're
expanding, where you are in it, and what the arguments are. In CPP you
also check for recursion and die if it happens. -John]
Return to the
Search the comp.compilers archives again.