3 ms·
Writing an optimizing production ready compiler doesn't seem to be an easy task, even today. I mean you can fork a compiler or look at the code, but maintaining
by senfiaj 4mo ago
Writing an optimizing production ready compiler doesn't seem to be an easy task, even today. I mean you can fork a compiler or look at the code, but maintaining your own one alone doesn't seem to be realistic.
>> - not writing compilers in assembly
Sure, but you still generate the machine code, right? You still have to master the instructions and their specifics of the target CPUs.
- bigfishrunning 4mo ago> Sure, but you still generate the machine code, right? You still have to master the instructions and their specifics of the target CPUs. You do, but self-hosted compilers tend to have two huge benefits: 1) they tend to be easier to reason about, being written in a high-level language 2) they exercise the code, and usually even seldom-used parts of the code, to make problems more noticeable
- senfiaj 4mo agoBut once you have written in assembly, you could start to write the next version in the higher level language. The first version (written in assembly) doesn't necessarily have to produce the most optimal code, just good enough and correct. Most of the improvements can be done in the self hosted compiler (in a higher level language). So this period did not have to last many years.
- Someone 4mo agoI am sure writing a self-hosted Fortran compiler is possible, but it wouldn’t be my first choice for writing a Fortran compiler, even given the Fortran of today. In the 1970s, it would have been really low on my list, likely below using a macro assembler.