Acme::URM is a Perl module that gives you the methods needed to emulate an URM in Perl.
Why? Because we can.
What is URM?
URM stands for unlimited register machine.
URM has unlimited number of registers: R0, R1, ... Those contain natural numbers: r0, r1, ... Default values for ri are 0.
Instruction for URM is one of the following instructions:
* Z(n) - set up register with index n to zero
* S(n) - increment value of register with index n by 1
* T(m, n) - set up register with index n to value of register with index m
* J(m, n, q) - conditional instruction: if values of registers with indexes m, n are equal, then go to insturction with index q (zero based index), else move to following instruction
Program of URM is a finite list of URM instructions.
SYNOPSIS
use Acme::URM;
my $rm = Acme::URM->new();
# program that summarize parameters given in R0,R1
$urm->program(
'T(0,2)',
'T(1,3)',
'J(3,4,6)',
'S(2)',
'S(4)',
'J(0,0,2)',
'T(0,3)',
'J(3,1,'.Acme::URM::LAST.')',
'J(3,2,11)',
'S(3)',
'J(0,0,7)',
'T(1,0)',
);
$urm->register( 0, 2, 2 ); # fill the registers
my $res = $urm->run(); # res must be 4
Product's homepage
Requirements:
· Perl