For the following, translate into three address codes, and make the abstract syntax tree
(1) x[i] = y[j] + z[k]
(2) a[i] = b[c[j]] + d[e[k] + f[i]]
(3) a[i][j] = b[k][i] + x
Three adress code for abstract syntax tree for :
(1) x[i] = y[j] + z[k]
T1= z[k]
T2=y[j]
T3= T1+T2
x[i]=T3
(2) a[i] = b[c[j]] + d[e[k] + f[i]]
a[i] = bc[j] + de[k] + f[i]
T1=f[i]
T2=de[k]
T3=bc[j]
T4=T1+T2+T3
a[i]=T4
or
a[i] = b[c[j]+ d[e[k] + f[i]]
=b*c[j] + d*e[k] + d*f[i]
T1=e[k]
T2=d*T1
T3=f[i]
T4=d*T3
T5=c[j]
T6=b*T[5]
T7=T2+T4+T6
a[i]=T[6]
HOPE I ANSWERED YOUR QUESTION AND WISH YOU ALL THE BEST.
PLEASE RATE THIS ANSWER WITH AN UPVOTE, THANKYOU.
Get Answers For Free
Most questions answered within 1 hours.