- answers✔✔A = B * C + (A * C)
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <id> + <expr>
| <id> * <expr>
| ( <expr>)
| <id>
- answers✔✔Assuming dynamic scoping, what is the value of y in function sub2 for both calling
sequences?
function big() {
function sub1() {
var x = 7;
sub2();
}
function sub2() {
var y = x;
var z = 3;
}
var x = 3;
sub2();
}
- answers✔✔Create a Parse Tree with the following input
,A ** B
<factor> → <expr> ** <factor>
| <expr>
<expr> → ( <factor> )
| <id>
<id> → A | B | C
- answers✔✔Develop a derivation and a Parse tree for the string
A=B+C*A
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <expr> + <term>
| <term>
<term> → <term> * <factor>
| <factor>
<factor> → ( <expr>)
| <id>
- answers✔✔Draw parse tree
A=B*(A+C)
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <id> + <expr>
| <id> * <expr>
| ( <expr>)
| <id>
, - answers✔✔Identify the Challenges in this Pass-by-Reference function in C++
void fun(int &first, int &second) {
first = 17;
second = 35;
}
//other stuff here
int total = 5;
fun(total, total);
- answers✔✔Identify the Challenges in this Pass-by-Result function in C#.
void Fixer( out int x, out int y) {
x = 17;
y = 35;
}
//other stuff here
f.Fixer(out a, out a);
- answers✔✔Identify the parts of the function with a partner.
Functions:
sumer(length = my_length, list = my_array, sum = my_sum)
def compute_pay(income, exemptions = 1, tax_rate)
float compute_pay(float income, float tax_rate, int exemptions = 1)
Note: These are from different programming languages.
- answers✔✔Look at slides 6/7 in syntax part 2
(e.g., HTML, CSS) - answers✔✔Markup