3 ms·
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 real
by not2b 7y ago
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.
- ken 7y agoI'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.
- kd0amg 7y agoLet'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.
- UncleOxidant 7y agoI 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.
- qtplatypus 7y agoOn the other hand LR compilers are fast. That is why golang uses an LR parser.