in Compiler Design retagged by
1,852 views
2 votes
2 votes
in Compiler Design retagged by
1.9k views

2 Answers

6 votes
6 votes
Best answer
  • $S \to A \mid B$
  • $A \to a \mid \epsilon$
  • $B \to b \mid \epsilon$


Now if I want to generate empty string ($\epsilon$) from above grammar, I have more than one option to generate it. Obviously grammar is ambiguous. No parser will work.

So, just for answer : Grammar is NOT LL(1).

selected by

1 comment

Yes right I was also thinking the same but  for the grammars in which there is difficulty to direct see the ambiguity we have to follow the Parsing table strategy or First and follow method. Isn't it??
0
0
0 votes
0 votes
First(S)^First(A) !=0 so it is not LR(1)

2 Comments

Answer is right i.e. it is not even LR(1) but pairwise disjointness is property of LL parser not LR parser.
2
2
I was asking for LL(1) now i got answer. I think it should be calculated as First(A) intersection First(B) = {epsilon} != null. Hence Not LL(1).
0
0

Related questions