← 📝 Intermediate Code Generation
Subtopic 2 of 5

8.2Quadruples, triples, indirect triples

Quadruple (op, arg1, arg2, result): easy to move. Triple (op, arg1, arg2): results referred by position, so moving breaks references. Indirect triples: a separate list of pointers to triples allows reordering.

#oparg1arg2result
0uminusct1
1*bt1t2
2uminusct3
3*bt3t4
4+t2t4t5
5=t5a

Quadruples name a result explicitly (temporary), so instructions can be moved freely: good for optimisation. (6 instructions, 5 temporaries)

Previous year questions: Intermediate Code Generation (5)

PYQs are grouped by topic, so this is the full set for Intermediate Code Generation; try the ones that match this subtopic. Open all 5 on the topic page.