The Gateway to Computer Science Excellence
+1 vote
Among LR(0), SLR(1) and LALR(1) which parser is going to detect error faster and why??
in Compiler Design by | 2.4k views

4 Answers

+3 votes
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.
The question is still unanswered.
+1 vote

I guess LALR(1) Since Error Detecting Capablity of lalr parser is the highest (because of more Blank entries in the LALR tables)

+1 vote
LALR(1) because it have more blank enteries

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

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(

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)

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,497 answers
95,320 users