Programming Language Concepts Cs 280 Final Exan Summer 2018 Problem 1 Using Following Exte Q43880616


Programming Language Concepts CS 280 Final Exan Summer 2018 Problem 1. Using the following extended BNF grammar, write a parse tree as an <expr> for each of the following expressions if one exists, and if one does not exist, write “No <expr> parse tree”. <expr> ::- <prim> | [<prim>,<expr>] <prim> ::- <id> ] (<expr>) <id> ::- XIYIZ a. X b. [[X,Y], [Z,x]] c. [([Y,X]), [Z,x]] Problem 2. Given the following program: int h, i; 2 void B(int w) f int j, k; i – 2 v; void A(int x, int y) f float i, j; B(h); 10 i = 3; 11 12 13 void main () f int a, b; h = 5; a = A(a, b); B(h); 14 15 3; b 2; 16 17 18 19 20 g a. Assume dynamic scoping and a call history of: main(line 17) ! A(line 10) ! B. For each function list all of the variables referenced and the line on which it was declared. b. Assume dynamic scoping and a call history of: main(line 18) ! B. For each function list all of the variables referenced and the line on which it was declared. Show transcribed image text Programming Language Concepts CS 280 Final Exan Summer 2018 Problem 1. Using the following extended BNF grammar, write a parse tree as an for each of the following expressions if one exists, and if one does not exist, write “No parse tree”. ::- | [,] ::- ] () ::- XIYIZ a. X b. [[X,Y], [Z,x]] c. [([Y,X]), [Z,x]]
Problem 2. Given the following program: int h, i; 2 void B(int w) f int j, k; i – 2 v; void A(int x, int y) f float i, j; B(h); 10 i = 3; 11 12 13 void main () f int a, b; h = 5; a = A(a, b); B(h); 14 15 3; b 2; 16 17 18 19 20 g a. Assume dynamic scoping and a call history of: main(line 17) ! A(line 10) ! B. For each function list all of the variables referenced and the line on which it was declared. b. Assume dynamic scoping and a call history of: main(line 18) ! B. For each function list all of the variables referenced and the line on which it was declared.
Expert Answer
Answer to Programming Language Concepts CS 280 Final Exan Summer 2018 Problem 1. Using the following extended BNF grammar, write a…
OR