The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+1 vote

+1 vote

The basic difference between the parser tables generated with SLR vs LR, is that reduce actions are based on the Follows set for SLR tables. This can be overly restrictive, ultimately causing a shift-reduce conflict.

An LR parser, on the other hand, bases reduce decisions only on the set of terminals which can actually follow the non-terminal being reduced. This set of terminals is often a proper subset of the Follows set of such a non-terminal, and therefore has less chance of conflicting with shift actions.

LR parsers are more powerful for this reason.

An LR parser, on the other hand, bases reduce decisions only on the set of terminals which can actually follow the non-terminal being reduced. This set of terminals is often a proper subset of the Follows set of such a non-terminal, and therefore has less chance of conflicting with shift actions.

LR parsers are more powerful for this reason.

+1 vote

LALR(1) because it have more blank enteries

LALR(1) uses canonical collection of LR(1) items which works on lookahead

LALR(1) uses canonical collection of LR(1) items which works on lookahead

0 votes

0 votes

When the input has a syntax error, the LALR parser may do some additional (harmless) reductions before detecting the error than would the canonical LR parser. And the SLR parser may do even more.

- Wikipedia(https://en.wikipedia.org/wiki/LR_parser#Lookahead_sets)

Hence, the error detecting capabilities of LALR parser (in general) is superior to that of SLR parsers. The LR(0) parsing table has fewer number of blank spaces than both LALR and SLR parsing tables, thereby making LR(0) parsers occupy the last position when comparing with the other two.

Thus, in the decreasing order of error detecting capabilities we have:

*LALR(1) > SLR(1) >> LR(0)*

- All categories
- General Aptitude 1.2k
- Engineering Mathematics 4.9k
- Digital Logic 2k
- Programming & DS 3.6k
- Algorithms 3k
- Theory of Computation 3.9k
- Compiler Design 1.5k
- Databases 2.9k
- CO & Architecture 2.5k
- Computer Networks 2.9k
- Non GATE 949
- Others 1.3k
- Admissions 409
- Exam Queries 419
- Tier 1 Placement Questions 17
- Job Queries 55
- Projects 9

34,781 questions

41,758 answers

118,934 comments

41,400 users