News for hackers. Stuff that matters.
Re:LALRPOP, an LR(1) parser generator for Rust by ufo on Monday January 25, 2021 @07:20PM (#25910806)
One of the main differences is that LALR parsers don't use backtracking to implement "choice". Parsing happens in a single pass over the input. With parser combinators, ambiguity is silently resolved by accepting the first option that the parser tries. Bottom up LR parsers also do a better job of dealing with left recursion, compared to top down parsers. If you want to parse something using a recursive descent parser (or combinators) you may need to rephrase the grammar to avoid left recursion.

Some of the main downsides of LR parsers are that you need to use a parser generator and you have to know how to resolve possible shift/reduce conflicts. It's more complicated than top down parser, which is just a bunch of regular recursive functions.

There are no comments on this comment yet.