ParaC is a small C-like compiler.
- Emits x86 asm (32 bit code).
- Has OpenMP-style parallel loops.
- Uses SSE for floating point arithmetic.
- Follows CDECL (ie the output is compatible with GCC-compiled C code).
- Support library includes
printint
andprintfloat
functions. - Nice error messages with errors underlined in the source
- Uses ANTLR4.
- Compiles in one pass.
- Can buffer asm output to reorder it if needed.
- Pushes every expression value on the stack.
- Uses pthreads for parallel loops.
To compile a program:
./ParaC.sh sample.c >sample.s
gcc -m32 sample.s src/ParaC.c -lpthread
./a.out
Use the test.sh
script to do that in one command:
./test.sh sample.c # creates a.out.s then a.out and runs a.out
- Avoid successive push/pop inside an expression.
- Enable 64 bit mode.
- String support