search
Log In
12 votes
3.4k views

Which grammar rules violate the requirement of the operator grammar? A, B, C are variables and a, b, c are terminals

  1. $A \rightarrow BC$
  2. $A \rightarrow CcBb$
  3. $A \rightarrow BaC$
  4. $A \rightarrow \epsilon$

(a) 1 only 
(b) 1 and 2
(c) 1 and 3
(d) 1 and 4

in Compiler Design
edited by
3.4k views
2
option A and D both will violate
3

the above question is incomplete, in original question paper option is given like this:

  1. (i) Only
  2. (i) and (ii)
  3. (i) and (iii)
  4. (i) and (iv)

Hence answer is D which include both grammar. 

0

 dkvg1892 From where this question is taken

1

Original question:

3 Answers

15 votes
 
Best answer

A/c to Operator precedence Grammar Two production should not be Adjacent (for exp as they are given in Option A) to each other .And there should not be any Eps Production .Why two production should not be Adjacent to each other is. In general when we write any Mathematical expression in Let take the C Language we are  not going to have 2 identifier side by side that is why we should see that Production should not be side by side.

So Correct Option Must be A and D because they violate the condition .


selected by
2 votes
option A

operator grammar is racist, it does not let two non terminals come together,

in short, no production has either an empty right-hand side or two adjacent nonterminals in its right-hand side.

actually option D should also not be allowed
0
Option D is the answer according to answer key of ISRO.
0
Here both Option(A) and option(D) are clearly violating the requirement of the operator grammar.
0
yes option D also correct
0 votes

Option A will be right option for it.

Because in between two variable there should be exist a terminal then such grammar is called as operator grammar.

Example of operator grammar.

  1. A→CcBbA→CcBb
  2. A→BaCA→BaC
  3. A→ϵ
  4. Example of not to be operator grammar is
  5. A->BCCB
Answer:

Related questions

8 votes
2 answers
1
3.3k views
Which statement is true? LALR parser is more powerful and costly as compare to other parsers All CFG's are LP and not all grammars are uniquely defined Every SLR grammar is unambiguous but not every unambiguous grammar is SLR LR(K) is the most general back tracking shift reduce parsing method
asked Jun 17, 2016 in Compiler Design jothee 3.3k views
7 votes
3 answers
2
2.3k views
Which one of the following is a top-down parser? Recursive descent parser Shift left associative parser SLR(k) parser LR(k) parser
asked Jun 17, 2016 in Compiler Design jothee 2.3k views
1 vote
2 answers
3
227 views
In operator precedence parsing we have the rule that production cannot have two adjacent non-terminals or an epsilon production, so this production, S--> ab is allowed but not S--> AB, A->a and B->b, though they are giving us the same output. Why so?
asked Jun 14, 2019 in Compiler Design Hirak 227 views
0 votes
3 answers
4
...