I will say that C is a perfect low level language for bootstrapping more complex systems and languages. If I were building a bootstrap compiler I would write it in C and have it emit C. Specifically C89/99 ONLY with no POSIX/GNU deps. that will guarantee a large swath of compiler and system support out of the box.
Worth also mentioning Crafting Interpreters by Robert Nystrom (craftinginterpreters.com) as a companion — it implements two interpreters in Java then C, covering a treewalk interpreter and a bytecode VM, and is freely available online. Together with this journey and nils-m-holm's Practical Compiler Construction mentioned above, you get a remarkably complete self-study path from parsing fundamentals all the way to code generation.
On the C vs typed language debate: C forces you to think about representation explicitly — no algebraic types to lean on, every tagged union is manual. That arguably teaches you more about what a compiler actually does structurally. But OCaml or Haskell's pattern matching makes the recursive descent so natural that it's worth attempting both if you have the time. They illuminate different things.
parallax_error | 15 hours ago
nurettin | 13 hours ago
anta40 | 9 hours ago
?
MisterTea | 3 hours ago
I will say that C is a perfect low level language for bootstrapping more complex systems and languages. If I were building a bootstrap compiler I would write it in C and have it emit C. Specifically C89/99 ONLY with no POSIX/GNU deps. that will guarantee a large swath of compiler and system support out of the box.
brcmthrowaway | 15 hours ago
azhenley | 15 hours ago
Muhammad523 | 4 hours ago
pjmlp | 10 hours ago
https://holub.com/compiler/
nils-m-holm | 9 hours ago
It is called Practical Compiler Construction. The Compiler Writing Journey is based on it.
kreco | 7 hours ago
maltyxxx | 7 hours ago
On the C vs typed language debate: C forces you to think about representation explicitly — no algebraic types to lean on, every tagged union is manual. That arguably teaches you more about what a compiler actually does structurally. But OCaml or Haskell's pattern matching makes the recursive descent so natural that it's worth attempting both if you have the time. They illuminate different things.
cxr | 4 hours ago
skyfantom | 5 hours ago
Muhammad523 | 4 hours ago
mzs | 4 hours ago
Unlike how a bunch of projects end right as they start to get good, this has a great ending. Thank you
cxr | 3 hours ago
Previously:
12 comments; 156 points. 2022 November 29. <https://news.ycombinator.com/item?id=33788013>
67 comments; 484 points. 2020 January 8. <https://news.ycombinator.com/item?id=21968420>