3 ms·
I mean I guess, it's only a small subset of C though (no floating point or structs even): $ cc float.c && ./a.out && ./c4 -s float.c && ./c4 float.c && echo
by mzs 7y ago
I mean I guess, it's only a small subset of C though (no floating point or structs even):
$ cc float.c && ./a.out && ./c4 -s float.c && ./c4 float.c && echo 'struct { int a; } s;' >struct.c && cc -c struct.c && ./c4 -s struct.c
hello, world 1.250000
1: #include <stdio.h>
2:
3: int main()
4: {
5: printf("hello, world %f\n", 1.25);
ENT 0
IMM 83656704
PSH
IMM 1
PSH
IMM 25
PSH
PRTF
ADJ 3
6: return 0;
IMM 0
LEV
7: }
LEV
hello, world 0.000000
exit(0) cycle = 13
1: bad global declaration
$
- dkersten 7y agoSo not really C in 4 functions then. Just some mini language that’s a subset of C, in four functions. That’s a much simpler target to reach, I guess.