A visual simulator for a modified p-machine

A discussion of the concepts of programming languages plays an important role in many computer science programs of study. The implementation of a programming language is a topic studied in a programming languages course. The P-Machine is a virtual machine designed by N. Wirth and serves as an example of how a program executes [1]. We present an overview of the P-Machine and a visual simulation of an example program that allows the viewer to follow the execution of the program. Our example program implements a function that finds the greatest common divisor (GCD). The example illustrates how activation records are created and reclaimed. Non-local storage access is also clearly illustrated in our example. The viewer is presented with an archetypical model of program execution that will enhance his or her understanding of this aspect of programming languages.