Re: C Preprocessor

"Math Stuff" <>
17 Apr 2002 23:21:13 -0400

          From comp.compilers

Related articles
C Preprocessor (2002-03-19)
Re: C Preprocessor (Randall Hyde) (2002-03-21)
Re: C Preprocessor (Math Stuff) (2002-04-17)
C Preprocessor (1993-04-26)
| List of all articles for this month |

From: "Math Stuff" <>
Newsgroups: comp.compilers
Date: 17 Apr 2002 23:21:13 -0400
Organization: Posted via Supernews,
References: 02-03-114
Keywords: C
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]

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.