acwj README

The project's README from github.com/DoctorWkt/acwj. As one markdown file: README.md.

A Compiler Writing Journey

In this Github repository, I'm documenting my journey to write a self-compiling compiler for a subset of the C language. I'm also writing out the details so that, if you want to follow along, there will be an explanation of what I did, why, and with some references back to the theory of compilers.

But not too much theory, I want this to be a practical journey.

Here are the steps I've taken so far:

I've stopped work on acwj and now I'm writing a new language called alic from scratch. Check it out!

Copyrights

I have borrowed some of the code, and lots of ideas, from the SubC compiler written by Nils M Holm. His code is in the public domain. I think that my code is substantially different enough that I can apply a different license to my code.

Unless otherwise noted,

acwj (DoctorWkt/acwj)

Searching Database…

13.5K ·GitHub
What is this?A documented tutorial series where the author builds a self-compiling compiler for a subset of the C language, split into roughly 64 incremental parts, each with working source code and a written explanation of the theory behind it.
Is this a working compiler or just a tutorial?Both — each numbered part adds real C source code to a growing compiler, paired with an explanation of what changed and why, so you end up with a functioning compiler as well as the story of how it was built.
Where should I start reading?Start at Part 0 (Introduction to the Journey) and go through the parts in order up to Part 64; each part's code builds directly on the previous one.
Do I need anything special to follow along?Just a C compiler and basic C knowledge — the project itself is written entirely in C with no external dependencies, Docker, or build system beyond standard tooling.
Is this still being actively updated?No, the author stopped adding new parts to acwj and moved on to writing a brand-new language called 'alic' from scratch.
Is the whole repo under one license?No — the source code and scripts are GPL-3.0, but the written English documents and images are licensed separately under Creative Commons BY-NC-SA 4.0, which restricts commercial reuse of the text.
What target does the compiler generate code for?It generates ARM assembly directly starting around Part 14, and the later parts add alternative backends using QBE (Part 63) and for the 6809 CPU (Part 64).
Does it compile all of C?No, only a deliberately limited subset of C — just enough for the compiler to be self-hosting, meaning it can eventually compile its own source code.
Did the author write every part from scratch?Not entirely — some code and many ideas were borrowed from Nils M Holm's public-domain SubC compiler, though the author considers the result different enough to license separately.
Creator
DoctorWkt
Size
4 MB
Stars
13.5K
Updated
CommitJun 06
Age
7y
Commits · 90 Days