recategorized by
5,182 views
0 votes
0 votes

Consider the following two Grammars:

$G_1 \: : \: S \rightarrow SbS \mid a$

$G_2 : S \rightarrow aB \mid ab, \: A \rightarrow GAB \mid a, \: B \rightarrow ABb \mid b$

Which one of the folloeing options is correct?

  1. Only $G_1$ is ambiguous
  2. Only $G_2$ is ambiguous
  3. Both $G_1$ and $G_2$ are ambiguous
  4. Both $G_1$ and $G_2$ are not ambiguous
recategorized by

2 Answers

0 votes
0 votes

for grammar G1

try to make string    ababa   then we will get two parse tree

so G1 is ambiguous 

 

for grammar G2

try to make string    ab   then we will get two parse tree

so G2 is ambiguous 

so C is the correct option

edited by

Related questions

0 votes
0 votes
3 answers
1
Pooja Khatri asked Jul 13, 2018
1,284 views
The set $A = \{ 0^n \: 1^n \: 2^n \mid n=1, 2, 3, \dots \}$ is an example of a grammar that isContext sensitiveContext freeRegularNone of the above
1 votes
1 votes
2 answers
2
Pooja Khatri asked Jul 13, 2018
15,274 views
Two finite state machines are said to be equivalent if they:Have the same number of edgesHave the same number of statesRecognize the same set of tokensHave the same numbe...
0 votes
0 votes
2 answers
3
0 votes
0 votes
6 answers
4