C compiler compiling C (following Nora Sandler's Writing a C Compiler).
I tried to call it cc, but that led to a ton of clashes with the system's existing cc.
You'll need a working installation of opam (Homebrew works for this).
git clone --recurse-submodules [email protected]:penelopeysm/cc.gitopam install . --deps-only
eval $(opam env)
dune buildThere's a small shell script to run the tests:
./runtests --chapter 1where any arguments are just passed on to the test runner (inside writing-a-c-compiler-tests/).
There's a small website, in web/, in which the OCaml code is compiled to JavaScript using js_of_ocaml and run in the browser.
You can either view it at https://pysm.dev/cccc, or to run it locally, do:
dune build web/main.js
python3 -m http.server --directory webI'm trying to take notes as I go along. These will be stored in NOTES.md.