Starting from:
$35

$29

Problem 1 Solution

At  the beginning of class on the due date,  submit your neatly presented solution with this page stapled   to the front (5 points).

Given the following C program, construct two intermediate representations for the program: an abstract syntax tree (AST) and a list of 3-address code statements.

main()
{
int sum, i, j;

1.    sum = 0;
2.    i = 1;
3.    while (i <= 5) { 4.        scanf("%d",&j);
5.    if (j < 0)
    6. break;
    7. sum = sum + j;
    8. if (sum > 10)
    9. continue;
10.    i = i + 1;
11.    }
12.    printf("sum is %d", sum);
}

























1

More products