Pascal NoPascensor
Pascal NoPascensor

Reputation: 171

LR(1) - How to compute Lookaheads

I have trouble understanding how to compute the lookaheads.

Lets say that I have this extend grammar:

S'-> S
S -> L=R | R
L -> *R | i
R -> L

I wrote the State 0 so:

S'-> .S, {$}
S -> .L=R, {$}
S -> .R, {$}
L -> .*R, {=,$}
L -> .i, {=,$}
R -> .L {=,$}

Using many parsing emulator i see that all calculators says:

R -> .L {$}

Why? Can't the R be followed by a "="?

Upvotes: 0

Views: 122

Answers (0)

Related Questions