This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: CSC402 - Assignment #3 Due in class Wednesday 10/5 Version 1.0 Introduction The goal is to implement an interpreter for an abstract stack machine lan- guage. Consider the following abstract stack machine bytecode instructions: push NUM- pushes the integer value NUM on the stack. push VAR- pushes the integer value stored in variable VAR on the stack. pop- pops the value on the top of the stack and discards it. print- pops the value on the top of the stack and prints it to the terminal screen. store VAR- pops the value on the top of the stack and stores it in the variable VAR. ask- asks the user for an input value and then pushes that value on the stack. dup- duplicate the value on the top of the stack; pop top of stack temp, then push temp, and push temp again. add- pop top of stack temp1, pop top of stack temp2, then push value temp2 + temp1. sub- pop top of stack temp1, pop top of stack temp2, then push value temp2 - temp1....
View Full Document
This note was uploaded on 10/03/2011 for the course CSC 402 taught by Professor Staff during the Fall '09 term at Rhode Island.
- Fall '09