How to identify whether a grammar is LL(1), LR(0) or SLR(1)?

前端 未结 5 714
小蘑菇
小蘑菇 2020-12-04 06:07

How do you identify whether a grammar is LL(1), LR(0), or SLR(1)?

Can anyone please explain it using this example, or any other example?

X → Yz |

5条回答
  •  渐次进展
    2020-12-04 06:19

    With these two steps we can check if it LL(1) or not. Both of them have to be satisfied.

    1.If we have the production:A->a1|a2|a3|a4|.....|an. Then,First(a(i)) intersection First(a(j)) must be phi(empty set)[a(i)-a subscript i.]

    2.For every non terminal 'A',if First(A) contains epsilon Then First(A) intersection Follow(A) must be phi(empty set).

提交回复
热议问题