JStack
JStack is a Java based stack machine emulator that would probably go nicely with this course at Kent. It's pretty simple to use although you will need to compile it yourself.
Compile using "javac -cp . *.java" and run using "java -cp . StackMachine text.file" where text.file is a textfile containing stack machine instructions
Now that you've read all that, click here to download JStack :)
JStack is liscenced under the GPL
Supported instructions:
- Load n - Takes thing stored in memory at location n and places on top of the stack
- Store n - Takes the top of the stack and stores at location n
- LoadLit n - Loads the number "n" onto the top of the stack
- IAdd - Takes the top two stack elements, adds them and puts back on top of the stack
- ILess - Takes the top two stack elements, if the top is less than top - 1, 1 is put on top of the stack. Otherwise, 0 is put on top of the stack
- Jump n - Increments the program counter n times (So jumps some instructions)
- JumpIf x n - Jumps x places if the top stack element is equal to n (Thanks to ZoFreX for the correction)