blob: 39958136890dee3a85d7ccc9efa3f3363ea52d83 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001This is another proof that Vim is perfectly compatible with Vi.
2The URM macro package was written by Rudolf Koenig ("Rudi")
3(rudolf@koeniglich.de) for hpux-vi in August 1991.
4
5Getting started:
6
7type
8in your shell: vim urm<RETURN>
9in vim: :so urm.vim<RETURN>
10in vim: * (to load the registers and boot the URM-machine :-)
11in vim: g (for 'go') and watch the fun. Per default, 3 and 4
12 are multiplied. Watch the Program counter, it is
Viktor Szépedbf749b2023-10-16 09:53:37 +020013 visible as a comma moving around.
Bram Moolenaar071d4272004-06-13 20:20:40 +000014
15This is a "standard URM" (Universal register machine) interpreter. The URM
16concept is used in theoretical computer science to aid in theorem proving.
17Here it proves that vim is a general problem solver (if you bring enough
18patience).
19
20The interpreter begins with register 1 (not 0), without macros and more-lines
21capability. A dot marks the end of a program. (Bug: there must be a space
22after the dot.)
23
24The registers are the first few lines, beginning with a '>' .
25The program is the first line after the registers.
26You should always initialize the registers required by the program.
27
28Output register: line 2
29Input registers: line 2 to ...
30
31Commands:
32a<n> increment register <n>
33s<n> decrement register <n>
34<x>;<y> execute command <x> and then <y>
35(<x>)<n> execute command <x> while register <n> is nonzero
36. ("dot blank") halt the machine.
37
38Examples:
39
40Add register 2 to register 3:
41 (a2;s3)3.
42Multiply register 2 with register 3:
43 (a4;a5;s2)2; ((a2;s4)4; s3; (a1;a4;s5)5; (a5;s1)1)3.
44
45There are more (complicated) examples in the file examples.
46Note, undo may take a while after a division.
47