- The designer of the compiler decides the intermediate language.
- Syntax trees can be used as an intermediate language.
- Postfix notations, three address codes (quadruples) can be used as an intermediate language.
Syntax tree is a variant of the parse tree, where each leaf represents an operand and each interior node represent an operator.
A sentence a * (b +d) would have the following syntax tree
When each statement contains three addresses (two for operands and one for result), Most general kind of three-address code is
x = yop z
Where x, y and z are names, constants or compiler generated temporaries and op is any operator.
But we can also use the following notation for quadruples (much better notation because it looks like a machine code instruction)
Op y, z, x
Apply operator op to y and z and store the result in x.
Representation of Three-Address Codes
Three-address code can be represented in various forms i.e., quadruples, triples and indirect triples. These forms are demonstrated by way of examples below.
e.g., A = - B*(C +0)
Three address code is as follow
T1 = - B
T2 = C + D
T3 = T1* T2
A = T3
You can follow the detailed champion study plan for GATE CS 2022 from the following link:
Candidates can also practice 110+ Mock tests for exams like GATE, NIELIT with BYJU'S Exam Prep Test Series check the following link:
Get unlimited access to 21+ structured Live Courses all 112+ mock tests with Online Classroom Program for GATE CS & PSU Exams: