Initial class construction
This commit is contained in:
47
Git/usr/share/vim/vim81/macros/urm/README.txt
Normal file
47
Git/usr/share/vim/vim81/macros/urm/README.txt
Normal file
@ -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.
|
||||
|
16
Git/usr/share/vim/vim81/macros/urm/examples
Normal file
16
Git/usr/share/vim/vim81/macros/urm/examples
Normal file
@ -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.
|
22
Git/usr/share/vim/vim81/macros/urm/urm
Normal file
22
Git/usr/share/vim/vim81/macros/urm/urm
Normal file
@ -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
|
5
Git/usr/share/vim/vim81/macros/urm/urm.vim
Normal file
5
Git/usr/share/vim/vim81/macros/urm/urm.vim
Normal file
@ -0,0 +1,5 @@
|
||||
map * 1G/INIT
|
||||
j"iT@i1G/INIT
|
||||
dG
|
||||
map g 1G/^[(as;.]
|
||||
i
|
Reference in New Issue
Block a user