Re:Why Take a Compiler Course?
by skitter on Saturday March 25, 2023 @03:05PM
(#35305944)
I'm curious, why the focus on parsing? I only read parts of the Dragon Book, but it didn't go in much detail about other topics, such as types, either. Couldn't you just use a very simple syntax such as S-expressions or even start from an AST directly?
[ Parent
| on HN ]
Re:Why Take a Compiler Course?
by mathisfun123 on Saturday March 25, 2023 @04:04PM
(#35306689)
people hyperfocus on parsing because it's far and away the easiest part of a compiler - type inference, optimization, target codegen are infinitely harder and deeper wells to plumb.
FORTH ;)
Re:Why Take a Compiler Course?
by agiacalone on Saturday March 25, 2023 @04:06PM
(#35306713)
A few reasons, although you are only seeing part of the picture with the project. The lectures were all theory-based (more along what you would find in the book).
1. I had a whopping three weeks to prepare this course from scratch (welcome to Uni teaching) and it was what I could scrape together in that time.
2. Parsing is highly useful, and I felt my students could benefit from it.
3. It was what I did in undergrad.
4. It was not too difficult to accomplish, and a project like this can easily get out of hand for a semester project.
Re:Why Take a Compiler Course?
by markus_zhang on Saturday March 25, 2023 @04:24PM
(#35306911)
I agree with you that parsing, for most people, or even most software engineering people, are much more useful then the other stages. Code generation is also interesting and could be useful too but that's pretty much the two of them. All the "interesting" stuffs people spoke about (e.g. optimization) actually has very few use cases unless you are working on it directly.