Hacker News new | ask | show | jobs
by teddyh 1023 days ago
For some value of “C”:

> Notably, it doesn't support:

> structs :-( would be possible with more code, the fundamentals were there, I just couldn't squeeze it in

> enums / unions

> preprocessor directives (this would probably be 500 lines by itself...)

> floating point. would also be possible, the wasm_type stuff is in, again just couldn't squeeze it in

> 8 byte types (long/long long or double)

> some other small things like pre/post cremements, in-place initialization, etc., which just didn't quite fit any sort of standard library or i/o that isn't returning an integer from main()

> casting expressions

3 comments

Well, I set the 500 line budget up front, and that was really as much as I could fit with reasonable formatting. I'll be excited to see your 500 line C compiler supporting all those features once it's done ;-)
C--23

(Respect to the author for doing this, I just couldn’t resist the obvious joke)

I actually almost made it a C-- (https://www.cs.tufts.edu/~nr/c--/download/ppdp.pdf) compiler, but IIRC the `goto`s made me go with the regular C subset instead.
Basically like many C compilers outside UNIX during the 1980's.

RatC did not need 500 lines for its preprocessor support, by the way.