| Sorry if I've asked these years ago and just don't remember the answer. > The '/copy-to-ebx' after the slashes is just my way of helping the reader understand what the instruction does. I don't want the reader to have to consult the Intel manual for every instruction, even if I'm forcing the writer to do so. Why not make the comment the instruction and the bytes the (maybe even optional?) comment in that case then? From your first post. > The fact that C compilers are written in C contributes a lot of the complexity that makes compilers black magic to most people. Isn't this more a symptom of C though? I'm hoping this is generally not true if you replace C with other languages (but could be very wrong). But more generally, I'm thinking you could make "the compiler's inner workings is not black magic" a constraint rather than make not writing the higher level language in the higher level language the constraint. In my case, I tried that first route and then moved to instead having the compiler written in the higher level language but emitting output that's close enough to (my) handwritten lower level language. I'll have to read your two part post more carefully though. Glad to see this project getting some attention, even though in an unusual fashion. |
You're right to point out that there are two components to "C compilers written in C make compilers seem complex": the metacircularity, and C-specific difficulties. I think I was focusing on the first when I wrote that, but I can't exclude the possibility you raise. A better language might reduce the need to understand it operationally, by looking under the hood to understand what a line of code is translated to. The Mu way may well be a dead end, since the requirement of understanding translated code restricts how complex compiler optimizations can get. You probably don't want to understand Haskell's loop fusion by comparing source and generated code.
In my mind there's an idea maze where there are 3 major possibilities for improving the future of software:
a) Simple languages and translators that are easy to understand by running them. This is the Mu way.
b) Type-driven languages that are easy to understand by reading them. Haskell and OCaml seem to fit here, and they may well be the right answers.
c) Complex languages that discourage abstractions atop them. This is the APL way, and it too might end up being the right way.
I'm doing a) mostly because it seems to fit my brain better. I just can't seem to get into Haskell or OCaml or APL.