Unlimited Register Machine

Resources

urm program and samples (zip file):

urm_v1_0.zip

Source code:

urm.cpp

This page contains a Windows command-line emulator (simulator) program to process URM programs. The URM program should be in the form described by the Open University in the M381 Number Theory and Mathematical Logic course (Unit ML1), an example of which is shown below.

URM programs contain the following instructions.

This is a sample program to calculate the square of a number:

1 J(1,4,10)

2 C(1,4)

3 S(2)

4 J(1,2,10)

5 Z(3)

6 S(3)

7 S(4)

8 J(1,3,3)

9 J(1,1,6)

10 C(4,1)

and here is the output from the urm processor's execution of the URM program:

URM PROGRAM==============

1 J(1,4,10)

2 C(1,4)

3 S(2)

4 J(1,2,10)

5 Z(3)

6 S(3)

7 S(4)

8 J(1,3,3)

9 J(1,1,6)

10 C(4,1)

INPUT VALUES=============

R1 = 3

PROGRAM TRACE============

1) 3 0 0 0

2) 3 0 0 0

3) 3 0 0 3

4) 3 1 0 3

5) 3 1 0 3

6) 3 1 0 3

7) 3 1 1 3

8) 3 1 1 4

9) 3 1 1 4

6) 3 1 1 4

7) 3 1 2 4

8) 3 1 2 5

9) 3 1 2 5

6) 3 1 2 5

7) 3 1 3 5

8) 3 1 3 6

3) 3 1 3 6

4) 3 2 3 6

5) 3 2 3 6

6) 3 2 0 6

7) 3 2 1 6

8) 3 2 1 7

9) 3 2 1 7

6) 3 2 1 7

7) 3 2 2 7

8) 3 2 2 8

9) 3 2 2 8

6) 3 2 2 8

7) 3 2 3 8

8) 3 2 3 9

3) 3 2 3 9

4) 3 3 3 9

10) 3 3 3 9

STOP) 9 3 3 9

Output = 9

Using the URM processor

Download the zip file from this page.

Unzip the file into a folder e.g c:\urm.

Open a Windows command prompt (e.g. Start menu > Accessories > Command Prompt).

Navigate to the folder containing the program (e.g. cd c:\urm).

Execute the program as follows:

urm nsquared.txt nsquared_out.txt 5

Where nsquared.txt contains the urm instructions, nsquared_out.txt is the file you want the trace to be written to and 5 is the input value.

(Another example is: urm add.txt add_out.txt 10 12)

Resources

urm program and samples (zip file):

urm_v1_0.zip

Source code:

urm.cpp