Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Consider the following grammar for the for statements : for - stmt - - > for ( var = exp,exp, exp ) do stmt var

Consider the following grammar for the for statements :
for-stmt --> for ( var =exp,exp, exp) do stmt
var id
The informal semantic of the "for" statement is to:
Use the code generated for the three expressions between parentheses,
Initialize the loop control variable ("var") by the first expression appearing in the list,
Use the code generated for the statement
Loop by incrementing the control variable by the second expression in the list, until the control variable
value is greater than the value of the third expression in the list
a. Write an attribute grammar for generating three-address code for the above grammar.
b. Write the three-address code generated for the statement:
for (i=e1,e2,e3)dos1
Assuming that the code evaluating e1, e2, e3 are e1.code, e2.cod, and e3.code respectively and their values
are to be stored in t1,t2, and t3.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

This symbol represents the sample standard deviation of group i.

Answered: 1 week ago

Question

why do consumers often fail to seek out higher yields on deposits ?

Answered: 1 week ago