Re:Thought Experiment: An Introductory Compilers Class
by not2b on Monday February 17, 2020 @03:36PM
(#22350481)
Introductory compilers classes should drop LR parsing as a topic. It takes a huge amount of time to teach and while it is mathematically elegant, it isn't really a good approach to writing a compiler front end that produces high-quality error messages. Teach recursive descent and move on to more interesting topics.
[ Parent
| on HN ]
Re:Thought Experiment: An Introductory Compilers Class
by ken on Monday February 17, 2020 @08:36PM
(#22352680)
I'd go even further. Minimize the exposure time to parsers.
We started my undergrad compilers class with several weeks on parsing. I think it's by far the hardest aspect in all of compilerdom -- and as a Lisp programmer, I didn't understand the need to be tortured that way.
I do understand on a theory level why parsers would get put first in a compiler class, but they're a tremendous barrier to entry and just make the whole subject seem inaccessible. There's lots of other ways I can think of which would make it easier for newcomers to get some traction on the subject of compilers.
Re:Thought Experiment: An Introductory Compilers Class
by UncleOxidant on Monday February 17, 2020 @11:32PM
(#22353470)
I don't agree that parsing is the hardest aspect in all of compilerdom. More like parsing is the least interesting part of what makes a compiler. Perhaps as you allude to, use Lisp or S-expressions as the frontend language and then build the compiler as you don't need much of a parser. Then you can get straight to the more interesting bits.
Re:Thought Experiment: An Introductory Compilers Class
by kd0amg on Monday February 17, 2020 @09:00PM
(#22352777)
Let's go another step. Move parsing into a mandatory class on automata theory, where you can properly dig into the machine models underlying different parsing algorithms.
Re:Thought Experiment: An Introductory Compilers Class
by qtplatypus on Tuesday February 18, 2020 @04:51AM
(#22354729)
On the other hand LR compilers are fast. That is why golang uses an LR parser.