Answered step by step
Verified Expert Solution
Question
1 Approved Answer
For the final project, you generate code for expressions as discussed in class: the codeGen method for each kind of expression will generate code to
For the final project, you generate code for expressions as discussed in class: the codeGen method for each kind of expression will generate code to evaluate the expression, leaving the value on the stack. While this kind of code is easy to generate, storing intermediate values on the stack rather than in registers is inefficient. You might think we could instead require that the codeGen method for an expression should work as follows: Each expression node's codeGen method would have 1 parameter: a register number N, which would be either 0 or 1 For literals or identifiers, the codeGen method would simply load the appropriate value in register N. For expressions involving non short-circuited binary operators (+, *,
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started