xXMarcoXx
xXMarcoXx

Reputation: 11

LALR, LR(1) and SLR

Since LR (1) grammars are broader than LALR or SLR grammars, I have doubts regarding the proof of LR grammars. If a grammar is SLR or LALR, then does that mean that the grammar is also LR (1)?

In fact, since the method that uses lookaheads is more complex to carry out, I can therefore use the SLR method (without lookahead) or the LALR method to prove that a grammar is LR (1).

Upvotes: 1

Views: 149

Answers (1)

rici
rici

Reputation: 241671

If a grammar is SLR(k) or LALR(k) then it also LR(k). If a conflict is found while constructing the LR parser, that same conflict will be present in an LALR or SLR parser for the same grammar.

Upvotes: 2

Related Questions