Path: csiph.com!weretis.net!feeder9.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Michael Lehn Newsgroups: comp.compilers Subject: Re: A tiny self-hosting compiler used for teaching Date: Tue, 25 Aug 2026 08:05:06 +0200 Organization: Compilers Central Sender: johnl%iecc.com Approved: comp.compilers@iecc.com Message-ID: <26-08-007@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3744 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