adplus-dvertising
frame-decoration

Question

Which grammar violate rules of an operator grammar?
(i) P-> QR

(ii) P -> Q s R

(iii) P -> ε

(iv) P ->Q t

a.

(i) only

b.

(i) and (iii) only

c.

(ii) and (iii) only

d.

(iii) and (iv) only

Posted under Compiler Design

Answer: (b).(i) and (iii) only

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which grammar violate rules of an operator grammar? (i) P-> QR (ii) P -> Q s R (iii) P -> ε (iv) P ->Q t

Similar Questions

Discover Related MCQs

Q. Consider the grammar rule
E -> E1 − E2 for arithmetic expressions.

If E1 and E2 do not have any common sub expression, in order to get the shortest possible code

Q. The grammar
A ->AA |( A)| ε
is not suitable for predictive-parsing because the grammar is

Q. Consider the grammar
E ->E + n | E # n | n

For a sentence n + n, form of the reduction are

Q. S -> (S)| a
Let the number of states in SLR(1), LR(1) and LALR(1) parsers for the grammar n1 n2 and n3 respectively.

Q. Consider line 3:

Int main()

{ int 1,N;

Fro (I,1 N,1);

}

Identify the compiler’s response about this line while creating the object-module

Q. Which one of the following is true about the action of yacc for the given grammar?

Q. What precedence and associativity properties does the generated parser realize?

Q. Consider the following grammar.
S > S * E

S > E

E > F + E

E > F

F > id

Consider the following LR(0) items corresponding to the grammar above

(i) S -> S * .E

(ii) E -> F . + E

(iii) E -> F + .E

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

Q. Consider the following grammar
S > FR

R > * S | ε

F > id

In the predictive parser table, M , of the grammar the entries M [ S, id] and M [ R,$] respectively

Q. Consider the following translation scheme.
S > ER

R > * E{print{’ * ’);

R | f

E > F + E{print(’ + ’); | F F > (S) | id{print(id.value);}

Here id is a taken that represents an integer and id, value represents the corresponding integer value. For an input ‘2 * 3 + 4’, this translation scheme prints

Q. Consider the following C code segment.
for if i # i } } }

Which one to the following false?

Q. E -> number Eval number val
E E .val E .VAL E .val
E # E E .val E .VAL E .val
;

The above grammar and the semantic rules are fed to a yacc tool (which is an LALR (1) parser generator) for parsing and evaluating arithmetic expressions. Which one of the following is true about the action of yacc for the given grammar?

Q. E -> number Eval number val
E E .val E .VAL E .val
E # E E .val E .VAL E .val
;

Assume the conflicts part (a) of this question are resolved and an LALR (1) parser is generated for parsing arithmetic expressions as per the given grammar.
Consider an expression 3 # 2 + 1. What precedence and associativity properties does the generated parser realize?

Q. Consider the following grammar.
S -> S * E

S -> E

E -> F + E

E -> F

F -> id

Consider the following LR (0) items corresponding to the grammar above.

(i) S -> S * .E

(ii) E -> F. + E

(iii) E “F + .E

Given the items above, which two of them will appear in the same set in the canonical sets-of-items for the grammar?

Q. Consider the following grammar
S -> FR

R -> * S | ε

F -> id

In the predictive parser table, M, of the grammar the entries M [S, id] and M [R, $] respectively

Q. Consider the following translation scheme.
S -> ER

R -> * E{print{’ * ’);

R | f

E -> F + E{print(’ + ’); | F

F -> (S) | id{print(id.value);}

Here id is a taken that represents an integer and id. value represents the corresponding integer value. For an input ‘2 * 3 + 4’, this translation scheme prints

Q. Consider the following C code segment.
for for if i # i } } }

Which one to the following false?

Q. Which one of the following grammars generates the language
L = (a i b i | i ! j}?

Q. In the correct grammar above, what is the length of the derivation (number of steps starting from S to generate the string a l b m with l ! m?

Q. Consider the grammar with non-terminals
N = {S , C , S}, terminals T = {a, b , i , t, e}, with S as the start symbol, and the following of rules

S -> iCtSS1 | a

S1 -> eS | ε

C -> b

The grammar is NOTLL(1) because: