Skip to content

Files

Latest commit

 Cannot retrieve latest commit at this time.

History

History
30 lines (19 loc) · 1.09 KB

README.md

File metadata and controls

30 lines (19 loc) · 1.09 KB

Alloycc

A self-hosting C compiler that operates on x86-64 linux.

Setting up

For macOS:

  1. clone this repository.

  2. run make to build alloycc

(for macOS)

$ docker build -t compilerbook https://www.sigbus.info/compilerbook/Dockerfile
$ docker run --rm -it -v $PWD:/home/user compilerbook

:~$ make # rebuild alloycc on self-hosted basis

Miscellaneous

  • run make test to see alloycc passes all (simple but comprehensive) unit tests described in test/test.c
  • make test-all will double-check this test with self-hosted compiler, as well as ensuring self-hosted binaries does not differ from first build to second.
  • make clean will clean up binaries and tmp files.

Acknowledgement

Original ideas and design of this compiler are introduced by Rui Ueyama in compilerbook, a fantastic in-depth tutorial document to implement C compiler in "incremental" approach.

You could also refer to some of his open repositories, such as 9cc or chibicc for actual implementations.