21 votes 21 votes Which of the following grammar rules violate the requirements of an operator grammar? $P, Q, R$ are nonterminals, and $r, s, t$ are terminals. $P \rightarrow Q R$ $P \rightarrow Q s R$ $P \rightarrow \: \varepsilon$ $P \rightarrow Q t R r $ (I) only (I) and (III) only (II) and (III) only (III) and (IV) only Compiler Design gatecse-2004 compiler-design grammar normal + – Kathleen asked Sep 18, 2014 edited Jun 1, 2021 by Lakshman Bhaiya Kathleen 11.0k views answer comment Share Follow See all 3 Comments See all 3 3 Comments reply Vikash commented Aug 23, 2016 reply Follow Share ans-B 0 votes 0 votes Shiva Sagar Rao commented Feb 3, 2021 reply Follow Share An operator precedence grammar is a context-free grammar that has the property that no production has either an empty right-hand side or two adjacent non terminals in its right-hand side. Hence answer is B. Ref: https://en.wikipedia.org/wiki/Operator-precedence_grammar 1 votes 1 votes Vishnu__ commented Apr 23, 2022 reply Follow Share An operator grammar *cannot* have 2 things: 1) Two Adjacent NonTerminals, & 2) An null value 1 votes 1 votes Please log in or register to add a comment.
Best answer 41 votes 41 votes answer is B. Operator grammar cannot contain Nullable variable Two adjacent non-terminal on $\text{RHS}$ of production koushiksngh264 answered Dec 23, 2014 edited Nov 29, 2017 by kenzou koushiksngh264 comment Share Follow See 1 comment See all 1 1 comment reply Overflow04 commented Dec 27, 2022 reply Follow Share Please explain option IV P->QtRr 0 votes 0 votes Please log in or register to add a comment.
10 votes 10 votes (I) P --> QR is not possible since two Non Terminal should include one operator as Terminal. (II) Correct (III) incorrect. (IV) Correct. so I and III violate the requirements of an operator grammar. Hence (B) is correct option Bikram answered Dec 28, 2016 Bikram comment Share Follow See all 4 Comments See all 4 4 Comments reply reena_kandari commented Aug 1, 2017 reply Follow Share is PQ-->RsT is operator grammar or not? 0 votes 0 votes joshi_nitish commented Aug 1, 2017 reply Follow Share no, PQ-->RsT will also not be in operator grammer, because PQ is present in LHS means it has also been generated by some production like V ---> αPQβ which is also in grammer and voilating operator precedence condition.. 12 votes 12 votes vishalshrm539 commented Dec 24, 2017 reply Follow Share No, PQ-> RsT is not context free, so it cant be operator grammar. 5 votes 5 votes jatin khachane 1 commented Nov 14, 2018 reply Follow Share @joshi+nitish Not able to understand ur above comment .. is this right reasoning PQ -> Rst ...is not CFG hence not Operator Grammar /? 0 votes 0 votes Please log in or register to add a comment.