Sujet : Re: technology discussion → does the world need a "new" C ?
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.lang.cDate : 06. Jul 2024, 01:24:27
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v6a2rs$3gd9u$1@dont-email.me>
References : 1 2 3 4 5 6 7
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 05.07.2024 15:28, BGB wrote:
It is not so much a dislike of multidimensional arrays as a concept, but
rather, the hair they add to the compiler and typesystem.
Granted, one would still have other complex types, like structs and
function pointers, so potentially the complexity savings would be limited.
[...]
Though, the major goal for this sort of thing is mostly to try to limit
the complexity required to write a compiler (as opposed to programmer
convenience).
Like, for example, I had tried (but failed) to write a usable C compiler
in less than 30k lines (and also ideally needing less than 4MB of RAM).
But, if the language design is simplified some, this might be a little
closer. Might still be doable, but a C compiler in 50-75k lines is much
less impressive.
[...]
Well, when reading that there's immediately faint memories forming
in my mind about an (only 90 page) booklet of Nicklaus Wirth with
the title "Compilerbau" (don't know about English translations). It
illustrates how to construct a simple (Pascal like) compiler based
on a Recursive Descent parser. It's development is also implying a
bootstrap mechanism, IIRC. Given the large numbers of lines of code
you mention above this might be a sensible alternative. Maybe you
can find some stimulus for your project even if you started your
own project differently. Your above stated requirements to limit
the complexity of writing a compiler is certainly addressed there
in several ways; simple LL(1) parser, bootstrapping, table driven
approaches, complete but extensible language as an example, etc.
Janis
PS: Google found a PDF online[*] (which is obviously more extensive
than my 1st ed. book), so you can inspect it and inform yourself to
see whether it's of any use to you.
PPS: Note also that even if the book uses a Pascal-like design the
described mechanisms are not bound to that language. Use it for a
"C"-like language if you think that's a good idea. :-)
[*]
http://pascal.hansotten.com/uploads/books/Compiler%20Bau%20Nwirth%201986.pdf