not-abc: a tiny self-hosting compiler used for teaching
Posted: Mon Aug 24, 2026 10:08 am
Hi,
I thought this project might be of interest to some people here.
I teach high-performance computing to mathematics students at Ulm University. One of the things I wanted students to understand is what actually happens between source code and the machine, without turning the course into a full compiler construction course.
For that purpose I developed a small C-like language called ABC and a compiler for it. Later I wondered how small I could make a compiler that is still powerful enough to compile itself. That became not-abc:
https://github.com/michael-lehn/not-abc
It supports functions, local and global variables, pointers, if/else, while loops, recursion and dynamic memory. The compiler itself is written in not-abc and generates LLVM IR.
The point isn't really to create yet another programming language. I wanted the complete compiler to be small enough that students can understand the whole path from source code to generated code, while still getting to the point where self-hosting becomes real rather than something they only read about.
I'm currently rewriting more of the teaching material from German into English. I'd be very interested in meeting people here who are working on similar small compilers, languages or teaching projects, or simply find this kind of thing interesting. Feedback and discussion would be very welcome.
The ABC compiler and language used for this are available here:
https://github.com/michael-lehn/abc-llvm
I thought this project might be of interest to some people here.
I teach high-performance computing to mathematics students at Ulm University. One of the things I wanted students to understand is what actually happens between source code and the machine, without turning the course into a full compiler construction course.
For that purpose I developed a small C-like language called ABC and a compiler for it. Later I wondered how small I could make a compiler that is still powerful enough to compile itself. That became not-abc:
https://github.com/michael-lehn/not-abc
It supports functions, local and global variables, pointers, if/else, while loops, recursion and dynamic memory. The compiler itself is written in not-abc and generates LLVM IR.
The point isn't really to create yet another programming language. I wanted the complete compiler to be small enough that students can understand the whole path from source code to generated code, while still getting to the point where self-hosting becomes real rather than something they only read about.
I'm currently rewriting more of the teaching material from German into English. I'd be very interested in meeting people here who are working on similar small compilers, languages or teaching projects, or simply find this kind of thing interesting. Feedback and discussion would be very welcome.
The ABC compiler and language used for this are available here:
https://github.com/michael-lehn/abc-llvm