Simple Stack Machine

written by Teresa Carrigan


Run model in your browser


Top

WHAT IS IT?

This is a model of a generic zero-address computer, also known as a stack machine. This model does not show the numeric output of a program, but rather the standard infix expression for that output. This allows students to test their stack machine programs to see if the programs correctly implement the assigned expression.

Top

HOW IT WORKS

A generic stack machine assembly language has only six operations: Push, Pop, Add, Sub, Mul, and Div. Push adds an item to the top of the stack, then increments the stack pointer. Pop removes the item on the top of the stack. The items on the stack do not operate by themselves in this model; everything happens because of button clicks. This is inherent in any stack model, because only the top of the stack is allowed to be processed.


Home

Applets on this website were written by Teresa Carrigan in 2004, for use in computer science courses at Blackburn College, with the exception of the Fireworks applet. The applets made with NetLogo require Java 1.4.1 or higher to run. The applets made with NetBeans require Java 1.4.2 or higher to run. Applets might not run on Windows 95 or Mac OS 8 or 9. You may obtain the latest Java plugin from Sun's Java site.