The preprocessor is fiendishly tricky to write. I wondered how he did it in such a short time :-) I had to scrap mine and reimplement it 3 times.
I wish I had had https://www.spinellis.gr/blog/20060626/cpp.algo.pdf to work from.
The preprocessor is fiendishly tricky to write. I wondered how he did it in such a short time :-) I had to scrap mine and reimplement it 3 times.
I wish I had had https://www.spinellis.gr/blog/20060626/cpp.algo.pdf to work from.
Not that I have had any doubts about how hard it is...
https://github.com/facebookarchive/warp
and the one for the C compiler I wrote long ago:
https://github.com/DigitalMars/Compiler/blob/master/dm/src/d...
which is integrated with the C lexer for speed reasons.
I’m also interested in how one would write a C preprocessor in a day. It’s got so many tricky edge cases and whatnot.
Full disclosure: I looked into the future with my Chronoscope, and copied the most popular language!
open(2) is also called relatively frequently and AFAIK requires varargs if it’s implemented in C.