+1 vote
22 views

Which of the grammars are ambiguous?

1. $S\rightarrow 0S1 \mid 01$
2. $S\rightarrow +SS \mid -SS \mid a$
3. $S\rightarrow S(S)S \mid \epsilon$
4. $S\rightarrow aSbS \mid bSaS \mid \epsilon$
5. $S\rightarrow a \mid S+S \mid SS \mid S^{\ast} \mid (S)$
| 22 views

C.

option c can have two parse tree for same string, {  () ()   } thats why it is ambigious,
by (11 points)

OPTION A,B,D-We can easily say its not ambiguous on the basis of observation.

OPTION C- Getting 2 different parse trees for the string { () () }.

OPTION E- Getting 2 different parse trees for {a+a+a}.

So answer should be C and E.

correct me if m wrong (:

by Junior (633 points)
edited

+1 vote