31 31 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 16.5k views answer comment Share Follow Print See all 3 Comments 3 3 Comments reply Vikash commented Aug 23, 2016 reply Follow flag ans-B 0 0 replyShare Shiva Sagar Rao commented Feb 3, 2021 reply Follow flag 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 5 5 replyShare Vishnu__ commented Apr 23, 2022 reply Follow flag An operator grammar *cannot* have 2 things: 1) Two Adjacent NonTerminals, & 2) An null value 6 6 replyShare Please log in or register to add a comment.
Best answer 53 53 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 all 2 Comments 2 2 Comments reply Overflow04 commented Dec 27, 2022 reply Follow flag Please explain option IV P->QtRr 0 0 replyShare panipuri commented Jan 15 reply Follow flag $P \rightarrow$ variable terminal variable terminal i.e, NO two consecutiver varibale/ Non-terminals; Hence no violation 0 0 replyShare Please log in or register to add a comment.
14 14 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 4 4 Comments reply reena_kandari commented Aug 1, 2017 reply Follow flag is PQ-->RsT is operator grammar or not? 0 0 replyShare joshi_nitish commented Aug 1, 2017 reply Follow flag 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.. 14 14 replyShare vishalshrm539 commented Dec 24, 2017 reply Follow flag No, PQ-> RsT is not context free, so it cant be operator grammar. 6 6 replyShare jatin khachane 1 commented Nov 14, 2018 reply Follow flag @joshi+nitish Not able to understand ur above comment .. is this right reasoning PQ -> Rst ...is not CFG hence not Operator Grammar /? 0 0 replyShare Please log in or register to add a comment.
0 0 votes A grammar is an Operator Grammar if and only if its productions satisfy two mandatory conditions:No $\epsilon$-productions: No production has an empty right-hand side ($A \rightarrow \epsilon$).No adjacent non-terminals: No two non-terminals appear side-by-side on the right-hand side (e.g., $A \rightarrow \dots BC \dots$ is forbidden).Rules (I) and (III) violate the requirements.B. (I) and (III) only Taniii answered Aug 29 Taniii comment Share Follow 0 reply Please log in or register to add a comment.