An incremental (growing slowly!) compiler for C written in Haskell
- Install Haskell via stack
- Build hcc using stack
stack install
Note that stack install will put the executable on the path whereas stack build will only generate the executable in the ~/.local/bin
directory. the executable hcc
expects the stack exectuable (hcc-exe
) to be on the path.
- To run it, invoke the
hcc
executable in the project root
./hcc /path/to/source.c
The compiled executable will be in the same directory as the source file, and have the same name (e.g. source
in the example above).
- Unit tests are written using HSpec and can be run using stack
stack test
- Sample programs are included in
examples
and can be run usingtest-examples.sh
script
./test-examples.sh
These tests compare the executables against gcc
.