News for hackers. Stuff that matters.
Re:Compiling to Assembly from Scratch: the book, released by leapis on Sunday September 27, 2020 @04:44PM (#24610007)
Fantastic book, and one that's much needed in the landscape of compiler learning today. Many modern compiler books (such as Torczon & Cooper's "Engineering a Compiler") take the approach of showing low-level, linear IRs rather than actual assembly- a perfectly valid approach, to be sure, but one that leaves something to be desired. While compilers are interesting, I don't learn about them because I think I'll ever write a real one- I learn about them because I want to understand more about a tool at the core of my workflow. This book won't be the be-all end-all of understanding compilation to asm, especially on x86 machines, but it taught me much that my university compilers courses and the Dragon book could not. I was a little hesitant when I saw the book was written with Typescript in mind, but after reading an earlier draft I tend to agree with the author's assessment that it works well with the material, and isn't too hard to pick up with some limited javascript experience.
Re:Compiling to Assembly from Scratch: the book, released by halst on Sunday September 27, 2020 @05:15PM (#24610179)
Yeah, and picking a language was the hardest decision for the book. I wrote the compiler prototype for it in OCaml, but using it for the book would have narrowed its audience unnecessarily. In the end, I'm very happy with picking TypeScript: it allowed to discuss the matters of static and dynamic typing within the same language. Using Python with mypy would be another option, but then, since I wanted the source language to be a subset of the implementation language, I would have to explain parsing whitespace-sensitive code, which is tricky.
Re:Compiling to Assembly from Scratch: the book, released by halst on Sunday September 27, 2020 @05:00PM (#24610095)
Thank you for such a favorable comparison with the classics!