Computer Science EngineeringHardISRO SC
For the grammar S -> A b | B c; A -> a A | epsilon; B -> a B | d, how many total LR(0) items (all dotted positions over all productions, excluding the augmented rule) exist?
- A. 15
- B. 16
- C. 14
- D. 17
Correct answer: A. 15
A production with rhs length k has k+1 items (an epsilon production has 1): total 15.
Practise more Theory of Computation, Compilers & Digital Logic (ISRO CS) questionsTheory of Computation, Compilers & Digital Logic (ISRO CS): notes and key points
More Theory of Computation, Compilers & Digital Logic (ISRO CS) questions
- Consider the grammar S -> A b | B c; A -> a A | epsilon; B -> a B | d. Is the grammar LL(1)? If so the predictive parse table has how many…
- Three-address code: 1: x1 = x2 + 1; 2: x2 = x3 + 2; 3: x3 = x1 + 3; 4: x1 = x2 + 4; 5: x2 = x3 + 5; 6: goto 8; 7: x1 = x2 + 7; 8: if x1 <…
- Using Sethi-Ullman labelling (a left leaf needs 1 register, a right leaf operand can be a memory operand and needs 0), the minimum number…
- In register allocation by graph colouring, the interference graph has nodes v0..v7 and edges v0-v1, v0-v3, v0-v4, v0-v5, v1-v2, v1-v3…
- A flow graph has blocks B1: use{a,d} def{b}; B2: use{a} def{b,d}; B3: use{d} def{a,b,c}; B4: use{a} def{}. Edges: B1->B2, B2->B3, B2->B4…
- Build the DAG for ((((c + a) + (b - a)) ((a b) + (b + a))) + (((a b) + (b + a)) + ((a b) + (b + a)))) using value numbering, treating +…