Quadruple Record Structure in Compiler Intermediate Code
In compiler design, quadruple refers to an intermediate-code record format where each instruction is represented as a 4-part record, commonly written as . This means a quadruple contains four fields, not three or one.
In many courses, this is contrasted with triples (typically 3 fields) and indirect addressing using temporaries, but the key idea for quadruples is that each operation stores both operands and the destination/result separately.
Mermaid view of the record layout:
Key terms:
- Quadruple
- Triples
- Intermediate code
- Three-address code
Quadruples vs Triples (Compiler Intermediate Representation)
Solving the given MCQ
Question: “Quadruple is a record structure of (i) three fields (ii) four fields (iii) one field (iv) none of these”
Since a quadruple is the IR record form , it has exactly four fields.
Correct option: (ii) four fields.
Important caution: sometimes students confuse “quadruple” with “four-address” or with other IR variations. But the standard meaning of quadruple record structure in compiler textbooks is explicitly 4 components (operator, two operands, and result).
[CalloutBlock] below gives a quick mental check.
Pro Tip: 4-part memory check
If the record stores operator + operand1 + operand2 + destination, it’s a quadruple → 4 fields.
MCQ Reasoning Steps (Quadruple Fields)
- 1Step 1
Interpret 'quadruple' as the standard compiler intermediate-code record format with a fixed number of components.
- 2Step 2
Use as the canonical structure.
- 3Step 3
There are components: , , , and .
- 4Step 4
Select the option that states four fields → (ii).
Where Quadruples Fit in Compiler Design
Parse & Analyze
Step 1Source language constructs are identified."
Generate Intermediate Code
Step 2Statements are converted into IR records such as triples/quadruples."
Optimize
Step 3Simplifications and analysis may occur on the IR."
Translate to Target Code
Step 4IR is mapped to machine/assembly instructions."
Mini comparison (common confusion)
Below is a compact comparison that helps distinguish triples from quadruples.
This directly implies:
- Triples → 3 fields
- Quadruple → 4 fields
Field Count Comparison: Triples vs Quadruples
How many fields each intermediate-code record typically contains.
FAQ / Edge Checks
Knowledge Check
Quadruple is a record structure of:
Explore Related Topics
A row from a table is selected by: selection, projection, union, or none?
FIFO Branch-and-Bound Uses a Queue
FIFO Branch-and-Bound expands live nodes in the exact order they are generated, so it is implemented with a queue.
- A queue enforces first‑in‑first‑out, giving the algorithm a BFS‑like, level‑order traversal.
- LIFO Branch‑and‑Bound uses a stack and least‑cost Branch‑and‑Bound uses a priority queue.
- Bounding prunes unpromising nodes independently of the FIFO selection rule.
- Pseudocode: initialize , enqueue root, while dequeue front, generate children, enqueue survivors.
- The abstract answer is “queue,” not an array or other structure, even if an array may implement a queue.
Ambiguous Grammars in Formal Language Theory: Choosing the Correct Option