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: Sat, 05 Sep 2026 19:50:40 -0700 Organization: Compilers Central Sender: johnl%iecc.com Approved: comp.compilers@iecc.com Message-ID: <26-09-008@comp.compilers> References: <26-09-004@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="31382"; mail-complaints-to="abuse@iecc.com" Keywords: courses Posted-Date: 07 Sep 2026 11:35:54 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <26-09-004@comp.compilers> Xref: csiph.com comp.compilers:3760 > On 5. Sep 2026, at 17:18, George Neuner wrote: > On Tue, 25 Aug 2026 08:05:06 +0200, Michael Lehn > wrote: >> 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. > I also learned Pascal before C, and I always have preferred > Pascal-like syntax to the line noise that is typical of C. Ironically > most of my career was spent using C++, SQL and Scheme. ... Yes, I did totally change the declaration syntax. That is the point. :-) The two declarations look like this in ABC: a: array[10] of -> int; b: -> array[10] of int; Thus, `a` is an array of ten pointers to integers, whereas `b` is a pointer to an array of ten integers. The variable name is separated from its type, and the type itself can be read from left to right. `->` is a prefix type constructor, rather than merely a replacement for `*` within C’s declaration syntax. No parentheses or knowledge of expression-operator precedence are required to distinguish the two types. The same principle also applies to more complicated types. For example: f: -> fn(); g: -> fn(value: int); h: -> fn(value: int): int; declare pointers to functions with increasingly detailed parameter and return types. ABC is not intended to suggest that Pascal, Modula-2, or related languages did not already solve this problem. Quite the opposite: it deliberately preserves their clearer declaration logic while retaining C-like expressions and a low- level programming model.