University of Virginia, Department of Computer Science
CS655: Programming Languages
Spring 2000

Register Virtual Machine

Recall that a structured operational semantics is defined by:
C Set of possible configurations.
==> Transition relation (C x C)
I A function mapping a program to an initial configuration: Program ==> C.
F Set of final configurations.
O Output function that maps a final configuration to an answer: F ==> Answer.

For BARK using the infinite register virtual machine (RVM), we have:

C Instructions x PC x RegisterFile
A configuration is defined by an (infinite) array of instructions, a program counter (PC), and an infinite register file.
I For a Program with n commands numbered from 0 to n - 1:
Instructions[i] = Program[i] for i >= 0 && i < n
Instructions[i] = ERROR otherwise
PC = 0
RegisterFile[n] = 0 for all integers n
The initial configuration is created by pushing all the program commands into the Instructions array, setting the program counter to 0, and storing zero in every register.

Answer = RegisterFile[0]
When the machine terminates, the answer is in the first register.

Instructions[PC] = HALT
Execution terminates when the program counter is pointing to a HALT instruction.

CS 655 University of Virginia
CS 655: Programming Languages
Last modified: Mon Feb 26 12:48:15 2001