top | item 30486615

(no title)

wincent | 4 years ago

> I get annoyed because I have to work around C's warts to do what I want, and that is only happening because I think in my language

You "just" have to get to the point where your compiler is written in your own language. This may take a while. Go got there in V1.5:

https://go.dev/doc/go1.5

discuss

order

makapuf|4 years ago

It's funny/interesting that an 1kloc implementation of minimal self hosting Go exist, or C/pascal/oberon compilers ; perfect hindsight view etc. You theoretically could (well if nobody does, no you can't) create a nice language and its implementation quickly.

pjmlp|4 years ago

Wirth was even more drastic in what concerns writing bootstraped compilers.

I don't recall in what paper from him I have read this, so take the story with a grain of salt, also open to corrections.

He actually wrote the initial version of the compiler directly in Pascal.

How did he perform such thing, one would ask.

By writing it on paper using a Pascal subset good enough as stage 0, and then manually compiling the source code into corresponding Assembly instructions that he would then actually type into the cards.

So when he finally got the compiler done, it was already bootstrapped from the get go.

Additionally, P-Code originally wasn't designed to be an interpreter, rather to repeat the above process in an easier way across computer systems.

He was initially surprised that others took it to write Pascal interpreters instead of a bootstrapping tool.

Jabbles|4 years ago

> It's funny/interesting that an 1kloc implementation of minimal self hosting Go exist

Does it? That's not the technique Go introduced, they started by rebuilding Go from earlier versions written in C - but in fact the bootstrapping process may change soon, see https://github.com/golang/go/issues/44505