689 views
2 votes
2 votes
S-> S+S | S*S | a | €

Which is false?

a)  G is ambiguous

b)  L is ambiguous

c)  both a and b

d) none

3 Answers

Best answer
9 votes
9 votes
B should be the right answer.

The given grammar will give 2 different parse trees for a + a * a, so clealy the given grammar is ambiguous.

The language L is {epsilon, a, a+a, a+, +a, a*, *a, a*a, a+a+a, a+a*a, a*a+a, a*a*a, ....}

By the ambiguity of language, I guess here inherent ambiguity of that language is being referred.

A context-free language L is called inherently ambiguous if every context-free grammar deriving L is ambiguous.

So to prove that L is not ambiguous, I just have to come up with an unambiguous grammar for L.

Here is an unambiguous grammar for L:

S --> S + E | E

E --> E * F | F

F --> a | epsilon

So, L is not ambiguous.
0 votes
0 votes

The ans should seemingly be option a) since the language is not defined over it. Isn't it?

For reference kindly follow the link below on Grammar.Yeah!!

Hope it helps u. :) 

https://www.tutorialspoint.com/automata_theory/ambiguity_in_grammar.htm

Related questions

0 votes
0 votes
0 answers
1
Lucky sunda asked Jan 22, 2017
782 views
By seeing a grammar I can say it is ambiguous or not. But How can I say it is inherently ambiguous or not.?
0 votes
0 votes
2 answers
2