The Gateway to Computer Science Excellence
+8 votes
503 views
Consider the following context-free grammar
S → SS + | SS*| a

It is

a)LL(1)

b)LR(0)

c)Both

d)none
in Compiler Design by (265 points)
edited by | 503 views
0
Its unambiguous grammer i'm sure of that.
0
i think this is left recursive grammar so the option should be d that is none
0
The Grammar is unambiguous.....we dont get different parse trees for above derivations......
0
Grammer is LR(0) no RR and SR moves! and It's  unambiguous too.
0
ambiguous grammar is one that has either two leftmost derivations or two rigthtmost derivations for the same string
0
construct 2 different tree for same string then ?!
0

Given grammar is left recursive doesn't implies it is an ambiguous grammar. A grammar is ambiguous if it is left recursive and right recursive. The given grammar is not right recursive as there exist a terminal in the end of every production.

https://gateoverflow.in/84491/ambiguity

3 Answers

+3 votes
Best answer
Its a LR(0) grammer so answer is B. No RR or SR conflicts.

Wrong answer was given in ace test series. This grammer is unambiguous because only one parse tree is possible for any string generated by it.

Having more than one expansion have nothing to do with ambiguity.
by Junior (923 points)
selected by
0
I am gettong sr conflict
0 votes
option b
by (433 points)
0 votes
  • Given grammar is left recursive . And if a grammar is left recursive then it never be LL(1).

  • Given grammar is LR(0) HENCE SLR also . So option b is true .

by Boss (35.3k points)

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,666 questions
56,157 answers
193,767 comments
93,748 users