Thread

Zero-JS Hypermedia Browser

Relays: 5
Replies: 3
Generated: 06:28:46
that's because you never read a textbook on compiler design and construction. i did, when i was like, idk, 13 or something, i should try to remember exactly. borrowed a book using my mother's university library card. never got arround to it quite yet, but it's on my list to build a slimmed down version of Go, which i'm working title "moxie" as in, the soda with gentian based flavor sold in USA) i've specced up the revised grammar, and mostly modified the yaegi go interpreter to run i tried to build an actual binary compiler first, but that proved to be very complex and claude couldn't do it. but the interpreter was relatively easy, and once implemented, can then allow me to write the compiler in moxie. the standard technique is to make a bootstrap compiler, which only has the parts implemented required for the compiler to work. then, with that compiler, you refactor it a bit so that you use the full version where you previously used more clumsy constructions to avoid making bootstrap 2 compiler difficult to build, and then you have the final compiler. i'm using the interpreter to do the bootstrap 1, and because it's just a small set of changes, and mostly removals, i will be at stage two, the second bootstrap, already, effectively, and with that write the full compiler, and add the execution environment and ABI targets to the code generator. Go has an extensive toolkit for building tools that edit go code, which makes up a large chunk of what the compiler actually has in it. the tokeniser, which identifies all the reserved words, operators, etc, and generates a linear list of tokens. then there is an AST generator (abstract syntax tree) which produces the more complex, tree structured, syntax and grammar containing information, types, comment blocks, etc, and then after that, the compiler feeds the AST into the code generator, which can either generate another programming language (less common) or directly generate binary code for the processor. i hope you enjoyed that explanation, about why language compilers are usually written in the language they compile. once you have one, you can then use it to build updated versions with bugfixes and add/remove language features.
2025-12-05 21:49:42 from 1 relay(s) ↑ Parent 2 replies ↓
Login to reply

Replies (3)

Because a self referencing compiler could build rebuild Trojans from the first iteration of compiler without it being detectable. You run your sha sum line to check that it matches the signed version and it looks fine, but that's because no one knew there was malicious code in it from the previous compiler. Im probably saying this wrong.
2025-12-05 23:18:54 from 1 relay(s) ↑ Parent 1 replies ↓ Reply