Re: A tiny self-hosting compiler used for teaching

Michael Lehn <michael.lehn@uni-ulm.de>
Tue, 25 Aug 2026 08:05:06 +0200

          From comp.compilers

Related articles
A tiny self-hosting compiler used for teaching michael.lehn@uni-ulm.de (Michael Lehn) (2026-08-24)
Re: A tiny self-hosting compiler used for teaching Keith.S.Thompson+u@gmail.com (Keith Thompson) (2026-08-24)
Re: A tiny self-hosting compiler used for teaching michael.lehn@uni-ulm.de (Michael Lehn) (2026-08-25)
Re: A tiny self-hosting compiler used for teaching thanks-to@Taf.com (CóilínNioclásínGlostéir) (2026-09-04)
Re: A tiny self-hosting compiler used for teaching ram@zedat.fu-berlin.de (2026-09-05)
Re: A tiny self-hosting compiler used for teaching gneuner2@comcast.net (George Neuner) (2026-09-05)
Re: A tiny self-hosting compiler used for teaching ram@zedat.fu-berlin.de (2026-09-05)
Re: A tiny self-hosting compiler used for teaching gneuner2@comcast.net (George Neuner) (2026-09-05)
Re: A tiny self-hosting compiler used for teaching michael.lehn@uni-ulm.de (Michael Lehn) (2026-09-05)
[6 later articles]
| List of all articles for this month |
From: Michael Lehn <michael.lehn@uni-ulm.de>
Newsgroups: comp.compilers
Date: Tue, 25 Aug 2026 08:05:06 +0200
Organization: Compilers Central
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="43039"; mail-complaints-to="abuse@iecc.com"
Keywords: courses, available
Posted-Date: 26 Aug 2026 13:00:31 EDT

Thanks! I was actually aware of the other ABC, but thought the name collision
would probably not matter for a small educational project. The name also grew
historically, and the wordplay was simply too tempting.


The compiler my students write in the course was originally called “A Bloody
Compiler”, hence ABC, and was written in C. Later I replaced C in the course
with a small language I called “A Better C”. So the students ended up writing
“A Bloody Compiler” in “A Better C”.


The main motivation for A Better C is actually quite mundane. When teaching C,
I always found declarations unnecessarily difficult to explain. For example:






        int *a[10]; // array of 10 pointers to int
        int (*b)[10]; // pointer to an array of 10 ints


There is a perfectly consistent logic behind C declarations: you declare an
object in a form resembling how it is used. But for beginners this means that
they already need to understand operator precedence — in particular that
postfix operators bind more strongly than prefix operators — just to read a
declaration.


I learned Pascal before C myself, and always found Pascal declarations easier
to read because you can essentially read them from left to right.


That is almost the whole idea behind A Better C: it is basically C, but with
declarations following a Pascal-like logic. Since `^` already has a meaning in
C, I used `->` for pointers.


Apart from the declarations, I deliberately kept the language very close to C,
because the subsequent HPC courses use C or C++. The idea is that once
students have learned the basic concepts in ABC, moving on to C should require
learning C's declaration syntax rather than learning another substantially
different language.


Interestingly, when I introduced ABC some years ago, several colleagues were
quite concerned about this. Their argument was that students without prior
programming experience would now have to learn _two_ languages instead of
one, making things even harder for them.


In practice, we have seen the opposite. Since introducing ABC, students who
come to the course without previous programming experience have had a
noticeably easier time. They can first learn the programming concepts without
having to deal with some of C's syntactic peculiarities, and the later
transition to C or C++ has not been a problem.


So “A Better C” is not meant as a grand claim that I fixed C. :-) It is really
just C adjusted a little for the way I found it easier to teach.




Michael Lehn


University of Ulm, Institute for Numerical Mathematics
Helmholtzstr. 20
D-89069 Ulm, Germany
Phone: (+49) 731 50-23534, Fax: (+49) 731 50-23548


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.