Let i ∈ ℕ, i > 0. Further let:
Ri be the notation for register i of the register machine;
[Ri] be the notation for the content of register i. It can be any positive integer.
Syntax
I. Elementary commands
Ia. Ai are RM-programs.
Ib. Si are RM-programs.
II. Construction processes
IIa. If P and Q are RM-programs, so is PQ.
IIb. If P is an RM-program, so is (i P).
III. During implementation
The RM-program ends with a period.
Semantics
I. Elementary commands
Ia. Counting forward: Ai increases the content of Ri by one.
Ib. Counting backwards: If [Ri] > 0, Si decreases the content of Ri by one, otherwise the content stays at zero.
II. Construction processes
IIa. Composition: PQ will execute P first and Q afterwards.
IIb. Controlled iteration: (i P) executes P repeatedly until the value of register i is equal to zero.
III. During Implementation
The command “period” is reached: The execution of the RM-program ends.
if β is a list, then so is β, i with i ∈ {a, ... z}.
Q is a valid program (as defined above) only if i ∈ {a, ... z}.
i or <α> can be omitted, but at least one of them has to be indicated.
The programs Ai and Si cannot be overwritten.
Semantics
The semantics of the subprograms are very similar to the semantics of the program.
Lower case letters are variables. During execution they are replaced by the numbers inside the corresponding registers. Variables, which aren’t arguments, i.e. they do not show up left of the equal sign, are understood to be temporary registers. Temporary registers are set up during execution if needed and are deleted afterwards. They are not listed under Registers.
Examples of a (predefined) subprogram: Ti<j>=(j SjAi).
When using Ti<j> the variables i and j are replaced by registers, e.g. T2<1>. In this example (1 S1A2) is executed.
If a function f is calculated with the RM-program Pf, then the function of the number of calculation steps RSPf is used to determine the costs of the calculation. Every executed elementary command, i.e. every execution of Ai und Si that is necessary for the calculation, is evaluated in order to assess the overall costs.
Example:
With Pa: (1S1A2) the function a(x1,x2)=x1+x2 can be calculated.
In this case the costs of the calculation only depend on x1 and not on x2.
For Pa the function of the number of calculation steps is given by: RSPa(x1)=2x1
Quick start
There are two distinct modes:
Program entry & editing
Program execution
To switch from the entry & editing mode to the execution mode a (syntactically) correct RM-program
must be entered into the rectangular, white field labeled Program which initially contains a black dot.
Switchting from one mode to the other is done using the button in the top left corner labeled
Initialize program or Edit program, respectively.
RM-program
Registers
The main program requires more registers than have been declared.
R1:
R2:
R3:
R4:
Set register values to:
Program
.
✓
Sub programs
Load standard programs on initialization
Program execution
(with recursion stack)
Calculation steps: 0
The program might be caught in an infinite loop since there have been many changes to the recursion stack with no calls to Ai or Si. Please check the program and if you would like to continue its execution click one of the step buttons again.
The program tries to call a sub program that has not been defined. Please switch to the Edit program mode and define the sub program.
Controls
Single step
Automatic steps with a delay of
Calculate result stops after steps
Options
Check programs on entry
Display number of calculation steps
Display program execution
Save and load programs
print predefined sub programs if they are loaded on initialization
save:
load:
Predefined subprograms
Please note that you can overwrite these predefined subprograms with your own definitions.
Call
RM-program
Semantics
L<i>, Li<i>
(iSi).
Delete
Ti<j>
(jSjAi).
Transport
Ki<j>
(jSjAh)(hShAiAj).
Copy
Ae<i,j>
Ke<i>Ke<j>.
Normalized addition
Me<i,j>
Kh<i>(hShKe<j>).
Normalized multiplication
Instructions
The RM-Software consists of two main parts. In the first part, which is made up of Registers and Program, the program with all its components is defined. In the second part with the title Controls the program is executed. Only one of the two parts can be active at any time. The active part is shown against a white background while the inactive one is shown against a grey background. Changes and actions are only possible in the active part.
In order to switch between the main parts, click on the Initialize program- or Edit program-button, respectively, which is set above the main parts.
You can only switch to the execution part when all definitions are syntactically correct and a sufficient amount of registers has been set up (not counting temporary registers). If a program is syntactically incorrect, it will be highlighted red. If registers are missing a warning will be shown.
Switching to the definition part during execution will abort the ongoing calculation.
Please note that the RM-Software cannot be operated using only the keyboard. Especially the input fields for programs must be activated with a mouse click.
In the field Registers the initial values for the registers are set.
The "+"-button adds a new register.
The "-"-button deletes the last register.
The "Zero"-button sets all registers to zero.
The "Start values of the last initialization"-button sets all registers to the values of the last initialization.
In the field Program the RM-program is inserted (see Definition).
Please note: In some browsers using the "Backwards key" during entry of the program will lead to the browser calling the previously visited website. If this is the case you can use the arrow up instead of the "Backwards key".
In the field Subprograms the subprograms are defined (see Definition).
The "+"-button adds an input field for a subprogram.
The "Delete program"-buttons delete the program within the corresponding input field.
The "Remove input field"-buttons remove the corresponding input field.
In the Controls area you can decide how to execute the register machine.
If the program detects a perceived infinite loop caused by calling subprograms, the program will be paused and a warning will be shown. The controls offer the option to continue executing the program.
Using Single step the program moves one step, i.e. one execution of Ai or Si, forward.
Using Automatic steps the program moves forward step by step automatically. The delay between steps can be set by the user.
Using Calculate result the program is executed until the end or until it is cut off automatically after a defined number of steps to avoid infinite loops. If the program is cut off, you can continue the execution using the control elements. The number of steps until cut-off can be set by the user.
The Calculation steps are the number of times Ai and Si have been called so far during the execution.
The Program execution shows the current status of the calculation. The current step is highlighted in green. Please note that the recursion stack is ordered so that the program is at the very bottom and the called subprograms are stacked on top.
In the Options area the output settings can be adjusted.
In the Save and load programs area programs with and without predefined subprograms can be saved or loaded.