logoalt Hacker News

sphtoday at 4:20 PM4 repliesview on HN

Has anyone defined a strict subset of C to be used as target for compilers? Or ideally a more regular and simpler language, as writing a C compiler itself is fraught with pitfalls.


Replies

rwmjtoday at 4:33 PM

Not precisely, but C-- (hard to search for!) was a C-like (or C subset?) intermediate language for compilers to generate.

I found this Reddit thread that gives a bit more detail:

https://www.reddit.com/r/haskell/comments/1pbbon/c_as_a_proj...

and the project link:

https://www.cs.tufts.edu/~nr/c--/

manwe150today at 6:05 PM

Sounds like why LLVM was created? (and derivatives like MLIR and NaCL) Its IR is intended be be C-like, except that everything is well-defined and substantially more expressive than C.

stephenbennyhattoday at 4:33 PM

https://en.wikipedia.org/wiki/C-- for example?

nxobjecttoday at 6:00 PM

For portability, hopefully C89 as well?