In three address code a branch can only have a binary relational operator,
e.g.
if x relop y goto L1, where relop is (!=,==,>,>=,<,<=)
How would the following be represented as three address code format:
j = 0
while(j < 10 || j < 20)
{
System.out.println(i);
j++;
}
Here is my solution which is obviously incorrect:
main:
j = 1
sum = 0
L2:
if j < 10 || j < 20 goto L3
goto L4
L3:
mt2 = sum + 1
sum = mt2
mt3 = j + 1
j = mt3
goto L2
L4:
sum = 2