HACKER Q&A
📣 ezzato

Best books on building a programming language


I have this long thought about building a language for the age of ai.

Here is a non-exhaustive list of features i would love to have it included: - separate effect full code from pure logic - separate state and code - ai native debugger - native deterministic simulation testing - coding proofs - explicit type system - repl - wasm target

I have no background in compiler building or similar. I would just like to spend some weeks reading the best resource about this topic.

Please share any resource you recommend reading.


  👤 tnelsond4 Accepted Answer ✓
I tried reading the dragon book in my teens, never really understood it, it was too much theory for me.

I'd recommend starting with implementing a forth since it's the easiest language to write an interpreter/compiler for. From there you'll have enough experience to go for something bigger.

Making your own bytecode is really fun.

Ultimately you'll probably want your compiler to target llvm bytecode so that it works on every target automatically.


👤 markus_zhang
Crafting interpreters. Very well written and free of cost, but ofc I’d recommend purchasing a copy.

If you find it a bit hard to chew, there is a simpler book using Python: https://www.amazon.ca/Anthony-J-Dos-Reis/e/B001KE4SU8/ref=dp...

Another book: Game Scripting Mastery.