+1 vote
75 views
in Compilers & Operating Systems by

1 Answer

+1 vote
by
selected by (user.guest)
 
Best answer

Three-address code is a sequence of statements of the general form : X := Y Op Z where x, y, and z are names, constants, or compiler-generated temporaries; op stands for any operator, such as a fixed- or floating-point arithmetic operator, or a logical operator on Boolean-valued data. Note that no built-up arithmetic expressions are permitted, as there is only one operator on the right side of a statement. Thus a source language expression like x+y*z might be translated into a sequence

t1 := y * z  

t2 : = x + t1

Where t1 and t2 are compiler-generated temporary names. This unraveling of complicated arithmetic expressions and of nested flow-of-control statements makes three-address code desirable for target code generation and optimization. The use of names for the intermediate values computed by a program allow- three-address code to be easily rearranged – unlike postfix notation. Three - address code is a linearzed representation of a syntax tree or a dag in which explicit names correspond to the interior nodes of the graph.

Intermediate code using Syntax for the above arithmetic expression 

t1 := -c

t2 := b * t1

t3 := -c

t4 := b * t3 

t5 := t2 + t4 

a := t5

The reason for the term three-address code is that each statement usually contains three addresses, two for the operands and one for the result. In the implementations of three-address code given later in this section, a programmer-defined name is replaced by a pointer tc a symbol-table entry for that name.                 


Related questions

+1 vote
1 answer 266 views
asked Oct 10, 2019 in Compilers & Operating Systems by anonymous
+1 vote
1 answer 169 views
asked Oct 10, 2019 in Compilers & Operating Systems by anonymous
+2 votes
1 answer 146 views
asked Oct 10, 2019 in Compilers & Operating Systems by anonymous
+1 vote
1 answer 2.0k views
+1 vote
1 answer 3.7k views
+1 vote
1 answer 190 views
+1 vote
1 answer 139 views
asked Oct 13, 2021 in Hardware Systems & Electronics by anonymous
+1 vote
1 answer 355 views
0 votes
1 answer 3.8k views
+1 vote
1 answer 969 views
+1 vote
1 answer 157 views
+1 vote
1 answer 269 views
+2 votes
1 answer 517 views
+1 vote
1 answer 655 views
+1 vote
1 answer 1.5k views
+1 vote
1 answer 9 views
asked 5 days ago in Compilers & Operating Systems by (user.guest)
+1 vote
1 answer 14 views
+1 vote
1 answer 18 views
+1 vote
1 answer 15 views
+1 vote
1 answer 28 views
+1 vote
1 answer 25 views
asked Jan 17 in Compilers & Operating Systems by (user.guest)
+1 vote
1 answer 26 views
+1 vote
1 answer 45 views
+1 vote
1 answer 49 views
+1 vote
1 answer 47 views
+1 vote
1 answer 36 views
+1 vote
1 answer 48 views
asked Jan 9 in Compilers & Operating Systems by (user.guest)
+1 vote
1 answer 69 views
asked Jan 8 in Compilers & Operating Systems by (user.guest)
Welcome to CPENTalk.com
Solution-oriented students of computer engineering on one platform to get you that

ONE SOLUTION

...