Send Close Add comments: (status displays here)
Got it!  This site uses cookies. You consent to this by clicking on "Got it!" or by continuing to use this website.nbsp; Note: This appears on each machine/browser from which this site is accessed.
Q5: Quiz#5: Postfix code


1. Q5: postfix code
38: Quiz#5: Postfix code , Name: ___________________________

2. Background
The following provides some background on the quiz. The quiz requires you to do a manual simulation of stack-based code execution using stack-based code in postfix form, as in the following.

3. Postfix code execution
Use the provided postfix code and values for the variables in the postfix code. The variable values to be used will be provided. (Note: This was done in class when the exam was given and this text added after the exam). Example: (using the running example)

Postfix code:
x y & x ! y ! & |

Let x be 1 and y be 0

Sequence: (you should write something like the following, depending on the expression provided).
init stack to empty x    push x as 1 y    push y as 0 &    pop 0 as reg2    pop 1 as reg1    push reg1*reg2 as 0 x    push x as 1 &    pop 1 as reg2    push 1-reg2 as 0 y    push y as 0 &    pop 0 as reg2    push 1-reg2 as 1 &    pop 1 as reg2    pop 0 as reg1    push reg1*reg2 as 0 |    pop 0 as reg2    pop 0 as reg1    push reg1+reg2-reg1*reg2 as 0 pop 0 as result


4. Scoring rubric

CS 340 - Q5 : Quiz#5: Postfix code Your grade: _ / 20    [LATE] Late or redo penalty: _ / -20    Pre-rubric summary score: _ / 20 Note: The rubric system was created after this work was graded.    [CREDIT] Extra credit: _ / +4 Comments: