A virtual backplane is formed when the controller, modules,…
Questions
A virtuаl bаckplаne is fоrmed when the cоntrоller, modules, and power supply in an Allen-Bradley CompactLogix PLC are connected together.
Sоlve using the quаdrаtic fоrmulа. 4x2 - 16x - 20 = 0
Prоblem 1: Cоmpiler Types аnd Phаses (12 pоints) [5 minutes] (A) You wаnt to extend a compiler code base to implement a cross compiler feature so that it can compile to a target architecture (let say aarch64 ARM) from the host architecture (let say amd64). What are the following parts of the compiler code base would you have to change? (4 points). a. The frontend b. The backend c. Both (B) While debugging your compiler you found that the addition and multiplication operation have got interchanged, i.e., when you print the AST for (c = c + d), it is generating the AST for (c = c * d) and vice-versa. Where could the bug be? (4 points). a. The parser b. The code generator c. Both the parser and the code generator d. Neither the parser nor the code generator (C) The day before your compiler project submission you realized that you have included “while” loop which was explicitly asked by your instructor not to. Which part of the compiler can you modify with the least amount of effort so that if the TAs check for “while” loop the compiler won’t accept. (4 points). a. The scanner b. The code generator c. Both the scanner and the code generator d. Neither the scanner nor the code generator Problem 2: Regular expressions, finite automata and scanners (18 points) [12 minutes] Consider the following NFA over the alphabet (Sigma = { 0, 1 }). Give an equivalent DFA for the NFA. Your construction should follow the subset construction for converting NFAs to DFAs (do not give an arbitrary DFA accepting the same language). Name states of the DFA appropriately, according to the subset construction. You can give just the diagram of the DFA (a formal tuple notation is not required). (182 points): Problem 3: First and Follow Sets (30 points) [13 minutes] Let (G) be the grammar below. Using this grammar, answer the following questions. begin{align*}S & rightarrow C$ \C &rightarrow AAC mid Ba \A &rightarrow B mid C \B &rightarrow b mid lambda end{align*} (A) What is the first set of (C)? (12 points) (B) What is the follow set of (A)? (12 points) (C) Does (abba)$ belong to the language? You do not have to justify your answer. (6 points) Problem 4: LL Parsers (20 points) [15 minutes] Consider the following grammar: S → CBA$ (1) A → CAx (2) A → λ (3) B → CBy (4) B → λ (5) C → z (6) C → λ (7) The first and follow sets for the non-terminals of this grammar are: First(S) = {x, y, z, $} First(A) = {x, z, λ} First(B) = {y, z, λ} First(C) = {z, λ} Follow(S) = ∅ Follow(A) = {x, $} Follow(B) = {x, y, z, $} Follow(C) = {x, y, z, $} (A) Fill in the following parse table with production numbers. If there are two entries for a given cell in the parse table, list both. (16 points) x y z $ S A B C (B) Is the grammar LL(1)? Why or why not? (4 points) Problem 5. Code Generation (20 points) [15 minutes] (A) Draw an AST for the following piece of code. Assume that your AST has nodes for assignments, binary operations, variables, and literals. Don't forget the order of operations! (8 points) x = c - (12 + n) * x (B) Give assembly for the above expression, using the following assembly instructions (note that these instructions work differently than Risc-V!) You can use any letters you want to represent temporaries, just prefix them with “$”. (12 points) Assembly Description LD X, $Y Load the value stored in the variable X into the temporary Y LI (v), $X Load the value (v) into the temporary X $X = $Y + $Z Put the sum of temporaries Y and Z into X $X = $Y − $Z Put the difference of temporaries Y and Z into X $X = $Y ∗ $Z Put the product of temporaries Y and Z into X ST $X, Y Store the value inside temporary X into variable Y Congratulations, you are almost done with this exam. DO NOT end the Honorlock session until you have submitted your work to Gradescope. When you have answered all questions: Use your smartphone to scan your answer sheet and save the scan as a PDF. Make sure your scan is clear and legible. Submit your PDF to Gradescope as follows: Email your PDF to yourself or save it to the cloud (Google Drive, etc.). Click this link to go to Gradescope: Final Exam Return to this window and click the button below to agree to the honor statement. Click Submit Quiz to end the exam. End the Honorlock session.