diff options
Diffstat (limited to 'runtime/macros/urm')
-rw-r--r-- | runtime/macros/urm/README.txt | 47 | ||||
-rw-r--r-- | runtime/macros/urm/README.txt.info | bin | 0 -> 734 bytes | |||
-rw-r--r-- | runtime/macros/urm/examples | 16 | ||||
-rw-r--r-- | runtime/macros/urm/urm | 22 | ||||
-rw-r--r-- | runtime/macros/urm/urm.vim | 5 |
5 files changed, 90 insertions, 0 deletions
diff --git a/runtime/macros/urm/README.txt b/runtime/macros/urm/README.txt new file mode 100644 index 0000000..a1ecc65 --- /dev/null +++ b/runtime/macros/urm/README.txt @@ -0,0 +1,47 @@ +This is another proof that Vim is perfectly compatible with Vi. +The URM macro package was written by Rudolf Koenig ("Rudi") +(rudolf@koeniglich.de) for hpux-vi in August 1991. + +Getting started: + +type +in your shell: vim urm<RETURN> +in vim: :so urm.vim<RETURN> +in vim: * (to load the registers and boot the URM-machine :-) +in vim: g (for 'go') and watch the fun. Per default, 3 and 4 + are multiplied. Watch the Program counter, it is + visible as a komma moving around. + +This is a "standard URM" (Universal register machine) interpreter. The URM +concept is used in theoretical computer science to aid in theorem proving. +Here it proves that vim is a general problem solver (if you bring enough +patience). + +The interpreter begins with register 1 (not 0), without macros and more-lines +capability. A dot marks the end of a program. (Bug: there must be a space +after the dot.) + +The registers are the first few lines, beginning with a '>' . +The program is the first line after the registers. +You should always initialize the registers required by the program. + +Output register: line 2 +Input registers: line 2 to ... + +Commands: +a<n> increment register <n> +s<n> decrement register <n> +<x>;<y> execute command <x> and then <y> +(<x>)<n> execute command <x> while register <n> is nonzero +. ("dot blank") halt the machine. + +Examples: + +Add register 2 to register 3: + (a2;s3)3. +Multiply register 2 with register 3: + (a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. + +There are more (complicated) examples in the file examples. +Note, undo may take a while after a division. + diff --git a/runtime/macros/urm/README.txt.info b/runtime/macros/urm/README.txt.info Binary files differnew file mode 100644 index 0000000..1337937 --- /dev/null +++ b/runtime/macros/urm/README.txt.info diff --git a/runtime/macros/urm/examples b/runtime/macros/urm/examples new file mode 100644 index 0000000..9907d4a --- /dev/null +++ b/runtime/macros/urm/examples @@ -0,0 +1,16 @@ +Note that enough temporary registers should be provided for each example. +All should be initialised to 0. + +Initial register values for benchmarking: 0,8,3,0,... + +Performed on a Xenix 386/16: +Operation [sec, kbyte tmp space]: program + +Asym. Diff.[ 7, 4]: (s2;s3)3. +Abs. Diff. [90,81]: (a1;a4;s2)2; (a2;s1)1; (a1;a5;s3)3; (a3;s1)1; (s2;s3)3; (s5;s4)4; (a2;s5)5. +Add [ 7, 4]: (a2;s3)3. +Mult [227, 161]: (a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. +Copy [ 48, 25]: (a1;a3;s2)2; (a2;s1)1. +sign [ 30, 17]: (a3;s2)2; (a2;(s3)3)3. +!sign[ 36, 28]: (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3. +Div [630,1522]: (a9;s2)2; (a2;a10;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a2)2;(a2;s9)9;(a3;s10)10; (a9;a10;s2)2; (a11;a12;s3)3; (a2;s12)12; (a3;s9)9; (s2;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a1;s2)2; (a2;s10)10; (a3;s11)11; ((a12;a13;s3)3; (a3;s13)13; (s2;s3)3; (a3;s12)12; a14; (s1)1; (a9;a10;s2)2; (a11;a12;s3)3; (a2;s12)12; (a3;s9)9; (s2;s3)3; (a3;s2)2; (a2;(s3)3)3; a3; (s3;s2)2; (s3;a2)3; (a1;s2)2; (a2;s10)10; (a3;s11)11)1; (s2)2; (a2;s14)14. diff --git a/runtime/macros/urm/urm b/runtime/macros/urm/urm new file mode 100644 index 0000000..9cbefb7 --- /dev/null +++ b/runtime/macros/urm/urm @@ -0,0 +1,22 @@ +>0 +>3 +>4 +>0 +>0 +>0 +(a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3. +_________ +O ; =xp ( =x%hp ) @l a @db s @dt . =x0xkdd:ready _end_ +o 0 1 2 3 4 5 6 7 8 9 0 +_________ +INIT main(k), l, b, c, t, u, q, d +
"kT
"lT
"bT
"cT
"tT
"uT
"qT
"dT +=lF'wa/O
fpaw"zdt hp@z0"xD@x@k +=2ldwhp'wiGT'wp0P0"yD@ya =xlwP >0 =x%p I k/>0
ww"ydt 0D@y +'wa/o
fwF'wpi`ar`aF'wffp0"vD@v0"vDp03x@v'wa @c 0 0 0I f0w"wdt 0D@w +`ahmaF'wa 'aa1 > @b 0p0f>w"vdt 0D@v +'wa/o
wfbF'wpi`ar`aF'wffp0"vD@v0"vDp03x@v'wa @u 9 0 0I f9w"wdt 0D@w +`ahmaF'wa `alr0 > @q 0p0f>w"vdt 0D@v +`ahy2l'wa `ax >1 @t 0p0/>1
ww"idt 0D@i +=xwhpbldwhp'wpaG$ma0"yD@y@ + diff --git a/runtime/macros/urm/urm.vim b/runtime/macros/urm/urm.vim new file mode 100644 index 0000000..3108180 --- /dev/null +++ b/runtime/macros/urm/urm.vim @@ -0,0 +1,5 @@ +map * 1G/INIT
j"iT@i1G/INIT
dG +map g 1G/^[(as;.]
i
>,mkkmw@k +map T y$ +map F yl +map = 'kf, |