urmwhich reads from standard input and writes to standard output.
There is one command-line flag
-qwhich suppresses the step-by-step reporting.
The program is given as a sequence of instructions, which can be separated by whitespace, or by nothing. The ``opcodes'' Z, S, J and P can be given in upper or lower case. The program is terminated by the end of file, or by input that cannot be parsed as part of the program.
The handling for incorrect input is, to put it mildly, rudimentary. If anyone cares to improve it .
-qflag is not present, then the step number, instruction pointer and register state is printed after each instruction is executed.
If the computation halts, then the program prints a message and prints the final state of the registers.
If the computation has not halted after steps then the program stops with an error message. This limit can be changed at compile time.
If the value of a register would overflow the unsigned int type used to store it then the program halts with an error message.
To execute the computation , put the following into a file test.urm:
4 Z(2) Z(3) J(1,2,8) S(2) S(2) S(3) J(1,1,3) T(3,1)and type
urm < test.urmThis should produce the output:
Program: I1 Z(2) I2 Z(3) I3 J(1,2,8) I4 S(2) I5 S(2) I6 S(3) I7 J(1,1,3) I8 T(3,1) Step: 0 IP: 1 REGS: 4 0 0 0 0 0 0 0 Step: 1 IP: 2 REGS: 4 0 0 0 0 0 0 0 Step: 2 IP: 3 REGS: 4 0 0 0 0 0 0 0 Step: 3 IP: 4 REGS: 4 0 0 0 0 0 0 0 Step: 4 IP: 5 REGS: 4 1 0 0 0 0 0 0 Step: 5 IP: 6 REGS: 4 2 0 0 0 0 0 0 Step: 6 IP: 7 REGS: 4 2 1 0 0 0 0 0 Step: 7 IP: 3 REGS: 4 2 1 0 0 0 0 0 Step: 8 IP: 4 REGS: 4 2 1 0 0 0 0 0 Step: 9 IP: 5 REGS: 4 3 1 0 0 0 0 0 Step: 10 IP: 6 REGS: 4 4 1 0 0 0 0 0 Step: 11 IP: 7 REGS: 4 4 2 0 0 0 0 0 Step: 12 IP: 3 REGS: 4 4 2 0 0 0 0 0 Step: 13 IP: 8 REGS: 4 4 2 0 0 0 0 0 Step: 14 IP: 9 REGS: 2 4 2 0 0 0 0 0 Halts with return value 2 after 14 steps IP: 9 REGS: 2 4 2 0 0 0 0 0Alternatively, use the -q option and get:
Program: I1 Z(2) I2 Z(3) I3 J(1,2,8) I4 S(2) I5 S(2) I6 S(3) I7 J(1,1,3) I8 T(3,1) Step: 0 IP: 1 REGS: 4 0 0 0 0 0 0 0 Halts with return value 2 after 14 steps IP: 9 REGS: 2 4 2 0 0 0 0 0Replacing the 4 by a 3 in the initial data gives
Program: I1 Z(2) I2 Z(3) I3 J(1,2,8) I4 S(2) I5 S(2) I6 S(3) I7 J(1,1,3) I8 T(3,1) Step: 0 IP: 1 REGS: 3 0 0 0 0 0 0 0 Stopped after 1000000 steps IP: 5 REGS: 3 399999 199999 0 0 0 0 0
This document was generated using the LaTeX2HTML translator Version 0.6.4 (Tues Aug 30 1994) Copyright © 1993, 1994, Nikos Drakos, Computer Based Learning Unit, University of Leeds.
The command line arguments were:
latex2html -split 0 -address Steve
Linton urm.tex.
The translation was initiated by Steve Linton on Fri Feb 10 12:32:40
GMT 1995