Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

This midterm covers material from chapters 1 through 6. For this exam you will b

ID: 3577256 • Letter: T

Question

This midterm covers material from chapters 1 through 6. For this exam you will be applying
the ideas and skills from the first 6 chapters to a selection of extensions to the clite language.
(Chapter 6 is the typing chapter, and you may not be up to that chapter yet, but you have a
choice on what you want to design and/or implement.
The following chart specifies a selection of extensions on one axis and how far you should
develop those extensions. I have also assigned points, which are my best guess estimate of how
difficult those extensions may be for the indicated level of development. You should try to put
together a set of extensions through some level of development that adds up to 100.
For any extension, in order to get credit for it, you must also present sample programs,
considering all the possible reasonable uses, demonstrating how you anticipate using the feature.
For any row, in order to do column i you must have completed column i 1. For example, for
any row that you choose to do, you must do the sample programs!
Note that arrays are in the textbook for the lexical, BNF, and abstract syntax. So if you
do that you need to do the implementation!
Feature Sample
Program
Lexical Changes BNF changes Abstract
Syntax
Changes
Implement
arrays 0 0 0 0 30
add in initialization
declarations
(eg int
a = 5+3;)
5 10 10 10 20
tuples or
structures
5 10 10 10 20
Adding a
new namespace
for
each block
5 10 20 20 20
union type
(make sure
you understand
unions before
you try
this!)
5 10 10 10 30

Explanation / Answer

Compute f(X1) = X1+1:

Y1<=0; /* This is Strictly redundant */
loop X1;
Y1++;
endloop; /* Now Y1 = X1 */
Y1++;

Compute f(X1,X2) = 2*(X1+X2):


Z1<=0;
loop X1;Y1++;endloop; /* Z1 = Z1 */
loop X2;Y1++;endloop; /* Z1 = X1+X2 */
Z1<=0;
loop Y1;Z1++;Z1++;endloop; /* Z1 = 2*Y1 */

C lite program to add upto 100:


#include<stdio.h>

int main(){
int number = 1;

print(number);

return 0;
}
int print(number){
if(number<=100){
printf("%d ",number);
print(number+1);
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote