15 ms·
If you know basic programming (js/python), a day is more than enough to get the concept across using a tiny language. Could probably be done in an hour. The pr
by sieve 2y ago
If you know basic programming (js/python), a day is more than enough to get the concept across using a tiny language. Could probably be done in an hour.
The problem, always, is people are given terrible reading recommendations which makes the subject more complicated than it is.
- RossBencina 2y agoI never took a compilers course. The first reading recommendation I got was The Dragon Book. Perhaps not the worst starting place at the time (mid 90s) but my memory of it was that the book was front-loaded with automata and parser theory. At the time I didn't really make it past the front end. It would be interesting to see a compiler tutorial that started at codegen and worked backwards (or started at the ends: lexing and codegen, and worked towards the middle in alternating chapters).
- sieve 2y agoThe Dragon Book is terrible as an introduction. There are better books I would probably recommend, but not to a beginner. The best "complete" intro out there today is Nystrom's Crafting Interpreters.[1] [1] https://www.craftinginterpreters.com/contents.html https://www.craftinginterpreters.com/contents.html
- RossBencina 2y ago> There are better books I would probably recommend I'm curious what you'd recommend. For what it's worth my goal was to compile to machine code. Anything less would have seemed insufficient. Later I got Appel's "Modern Compiler Implementation in Java" and Allen and Kennedy "Optimizing Compilers for Modern Architectures". Cooper and Torczon "Engineering a Compiler" was recommended here recently. I haven't seen it.
- sieve 2y agoI got started from the books that were available here in the early 2000s. The one I like the most is "Programming Language Pragmatics" by Michael Scott, mainly for its simplicity. Then there is "Advanced Compiler Design and Implementation" by Steven Muchnick. I have Allen-Kennedy's book too, but I think it went over my head when I went through it. So I kept it aside. "Engineering a Compiler" is quite approachable. But, once you know the basics, you get the best bang-for-the-buck by looking at source code of various compilers and virtual machines.
- sitkack 2y agoThere is a whole body of non-academic work aimed at practioners for implementing compilers. Nils Holm's work https://t3x.org/ https://t3x.org/ Teaching and Learning Compilers Incrementally - Jeremy Siek - RacketCon 2023 https://www.youtube.com/watch?v=43VA_QaTRT8 https://www.youtube.com/watch?v=43VA_QaTRT8 Nanopass https://nanopass.org/ https://nanopass.org/ original paper that was the basis for nanopass http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf http://scheme2006.cs.uchicago.edu/11-ghuloum.pdf https://www.reddit.com/r/ProgrammingLanguages/comments/gnzrap/the_nanopass_framework_as_a_nanopass_compiler_els/ https://www.reddit.com/r/ProgrammingLanguages/comments/gnzra... The Crafting Interpreters and the Thorsten Ball books https://craftinginterpreters.com/contents.html https://craftinginterpreters.com/contents.html https://interpreterbook.com/ https://interpreterbook.com/ https://compilerbook.com/ https://compilerbook.com/ https://www.phind.com/search/cm7efcpv000002e6hqdbfojex https://www.phind.com/search/cm7efcpv000002e6hqdbfojex
- ratmice 2y agoI don't think that the ghuloum 2006 paper was the initial basis for nanopass, at least the paper A Nanopass Framework for Compiler Education∗ seems to predate it in 2004 https://dl.acm.org/doi/10.1145/1016848.1016878 https://dl.acm.org/doi/10.1145/1016848.1016878
- delta_p_delta_x 2y ago> It would be interesting to see a compiler tutorial that started at codegen and worked backwards (or started at the ends: lexing and codegen, and worked towards the middle in alternating chapters) This is exactly how my university's compiler course did it[1]. It was really nice to start with assembly and go upwards. We had all the lexing/parsing stuff being discussed around the middle of the semester rather than being saddled with theory-heavy regex, automata theory, etc right at the beginning. [1]: https://ilyasergey.net/CS4212/ https://ilyasergey.net/CS4212/