edited by
296 views
0 votes
0 votes

For-statements in C and Java have the form:
for $( expr_l ; expr_2 ; expr_3 ) stmt$
The first expression is executed before the loop; it is typically used for initializing the loop index. The second expression is a test made before each iteration of the loop; the loop is exited if the expression becomes $0$. The loop itself can be thought of as the statement $ \{strmt \ expr_3 ;\}$. The third expression is executed at the end of each iteration; it is typically used to increment the loop index. The meaning of the for-statement is similar to $ expr_1 ; while ( expr2 )  \ \{stmt \ expr_3 ; \}$
Define a class For for for-statements, similar to class If in Fig. $2.43$

.

edited by

Please log in or register to answer this question.

Related questions

0 votes
0 votes
1 answer
1
admin asked Jul 26, 2019
337 views
The programming language C does not have a boolean type. Show how a C compiler might translate an if-statement into three-address code.
0 votes
0 votes
0 answers
4
admin asked Sep 7, 2019
588 views
Add to the translation of Fig. $6.19$ rules for the following productions:$E\rightarrow E_{1}\ast E_{2}$$E\rightarrow + E_{1}\:$(unary plus)