3 ms·
c4 is very cool, but it's not a compiler in the usual sense of the term. It compiles to a kind of bytecode which it then interprets (like Python, for example),
by tom_mellior 7y ago
c4 is very cool, but it's not a compiler in the usual sense of the term. It compiles to a kind of bytecode which it then interprets (like Python, for example), but it doesn't generate assembly or machine code (like GCC or JIT compilers, for example).
But there's a more realistic compiler inside swieros: https://github.com/rswier/swieros/blob/master/root/bin/c.c https://github.com/rswier/swieros/blob/master/root/bin/c.c that emits actual "binaries" for the emulated toy CPU. It's hard to tell what exactly is going on though, as this is not "very readable and simple code".
- bicolao 7y agoIt's just a small step to generate machine code, this fork [1] can generate an executable, or run it JIT style, both on x86 (there's also the 'arm' branch) [1] https://gitlab.com/pclouds/c4 https://gitlab.com/pclouds/c4