not-abc: a tiny self-hosting compiler used for teaching

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).
Post Reply
michaellehn
Posts: 1
Joined: Mon Aug 24, 2026 10:00 am

not-abc: a tiny self-hosting compiler used for teaching

Post by michaellehn »

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
thewrongchristian
Member
Member
Posts: 471
Joined: Tue Apr 03, 2018 2:44 am

Re: not-abc: a tiny self-hosting compiler used for teaching

Post by thewrongchristian »

michaellehn wrote: Mon Aug 24, 2026 10:08 am 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
I think this is pretty neat!

I always wondered how the likes of Thomson and Ritche created the B then C programming languages, bootstrapping from implementations that don't even provide structures (I can't imagine doing anything complex in Fortran!).

I have a couple of questions/suggestions:

- Is the source in examples/not-abc.abc the source that produced the top level not-abc.ll?
- There is no LICENSE file in the repository, so it's not clear under what license the compiler is available.
Post Reply