The Gateway to Computer Science Excellence
+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)$
in Compiler Design by Veteran (54.7k points) | 22 views

2 Answers

0 votes
C.

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

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 by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
50,648 questions
56,459 answers
195,335 comments
100,188 users