home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol166 / markov.rec < prev    next >
Encoding:
Text File  |  1984-04-29  |  4.7 KB  |  158 lines

  1.  
  2. { [MARKOV.REC]
  3. [compile a Markov rule set into a REC program]
  4. [format: (antecedent, consequent)]
  5. [or      (antecedent, consequent).]
  6. [Harold V. McIntosh, 5 December 1980]
  7. [Harold V. McIntosh, 22 February 1981]
  8.  
  9. [A Markov algorithm is an attempt by the Russian mathematician
  10.  A. A. Markov to make a rigorous algorithmic process out of the
  11.  production schemes of E. L. Post. In a Post production, one is
  12.  required to exhibit a sequence of transformation steps, or to
  13.  prove that no such sequence can be found. This is a process
  14.  which may depend upon a considerable amount of ingenuity, or
  15.  involve non-constructive reasoning, which is unsatisfactory
  16.  from the algorithmic point of view.]
  17.  
  18. [A Markov algorithm consists of a sequence of pairs - antecedents
  19.  and consequents - which constitute transformation rules. They are
  20.  to be tried in the strict priority of the order in which they are
  21.  listed, and each is marked according to whether the process is to
  22.  be repeated again from the beginning or to be terminated forthwith.
  23.  If no rule applies, the process also stops.  Thus a quite definite
  24.  sequence of events is described, with which to effect a calculation.]
  25.  
  26. [Markov Algorithms can be modelled in REC with especial ease just
  27.  because they were taken as the model for REC's workspace and its
  28.  associated operators and predicates.]
  29.  
  30. [Markov's own book, which spells out his scheme in minute detail,
  31.  is still the best source to consult for a description of these
  32.  algorithms.  Paralleling the development of the theory of Turing
  33.  machines, his treatment culminates in the enunciation of a Universal
  34.  algorithm.
  35.  
  36.         A. A. Markov
  37.         The Theory of Algorithms
  38.         Academy of Sciences of the USSR
  39.         Moscow 1954 Leningrad
  40.  
  41.         (also - NTIS-TT60-S1085
  42.         Israeli Program for Scientific Translations
  43.         Jerusalem, Israel, 1954.)]
  44.  
  45. [30$ - input FCB]
  46. [31$ - output FCB]
  47.  
  48. [display w/cursor]        (248%I26%TLJZqt248%FD;;) D
  49.  
  50. [erase cursors]            (J(248%FD:JZ;);) E
  51.  
  52. [zero file control block]    ($m33cmpw0%(f:;)wnnS;) F
  53.  
  54. [create input, output FCB's]    ('5C'H12wA' 'Ew;B
  55.   [generate file names]      9aQpG'REC'|m (Z3b' 'E'MKV';Q;)|m w
  56.   [open input file]         n30$rS 30@f
  57.   [open output file]         n31$rS 31@g31@e
  58.                 ;) G
  59.  
  60. [close file]            (
  61.   [clear wkspace, inp file]     @p:L@y:(@p:0=;e26%(f:;)@p;;)
  62.   [close fil.REC]         31$r16k
  63.                  ;) H
  64.  
  65. [initialize]            (J@Wj@!;@!;) I
  66.  
  67. [insert text as read]        (@D@$@::;) J
  68.  
  69. [WS up to cursor to disk]    (jJ<(@p:L;)Zz>;) P
  70.  
  71. [read, place in workspace]    (@$@::;) R
  72.  
  73. [15-line window]        (AB(10%EA:;)qL
  74.                   15(d(10%FA;L(26%Fj;Z;)):;)Y<;<) W
  75.  
  76. [open file or create it]    (@h$r15K(255=22K;;)LL;) e
  77.  
  78. [open file or report absence]    (@h$r15K(255='new file 'T;;)LL;) f
  79.  
  80. [delete file if present]    (@h$r19k;) g
  81.  
  82. [CP/M's DMA address]        ('80'H26k;) h
  83.  
  84. [write one record]        (@Ej((26%EZD0;128(a);))qL26k31$r21kD'.'TL;) p
  85.  
  86. [Markov subroutines]        ("{
  87.   [cr,lf]            (2573TL;)&
  88.   [read phrase]         (R13%='';T08%(=2080[sp,bs]TL)(@J|;L@J;);)J
  89.   [sign-on line]        ('[[]]'TL@&'Initial Axiom:'TL@&@JI;:)R
  90.   [write workspace]        (JZqt;)W
  91.   [final statement]        (@&'Production:'TL@&JZqt;)X
  92.                 "I;) s
  93.  
  94. [Markov rule]            ('('FD39%I
  95.                 ','FD39%I'FD'I39%I')'FD
  96.                 ('.'ED';';':';)39%I'I'II
  97.                 ;;) t
  98.  
  99. [Markov preface]        ("(@R(@&@WRL"I2573I;) u
  100.  
  101. [Markov postscript]        (";;)@X;;)}"I;) v
  102.  
  103. [compile a MARKOV file]        (Jj
  104.   [change file extension]      ('.MKV]'FD'.REC]'Iz;;)
  105.   [find display message]      ('[['F']]'UQD;'';)
  106.   [look for code gap]          ('('Ej;2573Ez2573Ez2573Ez2573Ej2bD;A:;)
  107.   [insert preface; to disk]      's'TL@s<'[[]]'FDIZ>@uz@P
  108.   [compile each function]      ('t'TL@tz@P'('Fj:;)
  109.   [insert postscript]          'u'TL@vz@P
  110.                 ;) w
  111.  
  112. [append a record]        (128(e)L;qL26k30$r20K0=L;DLL@h) y
  113.  
  114. [back to line feed]        (10%Ez;B:j;)0
  115. [bracket a line]        (@010%V;Z;)1
  116. [back to preceding line]    (@0BB@0;;)2
  117. [cr,lf]                (2573TL;)&
  118. [read w/error correction]    (RT08%=127%;13%=2573;26%(=);)$
  119. [clear screen]            (26%TL;)!
  120. [erase on ro, insert others]    (127%=z(B;;)D;I;):
  121. [form next window]        (Zz>@W@!;)>
  122. [cancel line]            (24%TL;)^
  123.  
  124. (    'd' [delete] =        (ABD;;);
  125.     'i' [insert] =        @J@!;
  126.     'j' [beginning] =    Jj;
  127.     'x' [exchange] =    (ABD;;)RTI;
  128.     'z' [to end] =        Z;
  129.     127%[delete] =        @1D@!;
  130.     124%[ver bar: next] =    (10%FA;J>(10%FA;;)@Wz@!;;);
  131.     13% [carr ret] =    @0;
  132.     96% [prime: up line] =    (BA@2;J>@2@Wj@!;;);
  133.     95% [undrscore: back] =    (Bj;;);
  134.     'n' [next record] =    >(@p;L;)(@y;;)J(@W;;);
  135.     'p' [write 1 record] =    >(@p;L;)J(@W;;);
  136.     'y' [read 1 record] =    >(@y;'eof:'TL;)J(@W;;);
  137.     ' ' [advance] =        (A;;);
  138.     '>' [next window] =    (@>j;>@I;);
  139.     '<' [beg window] =    >@I;
  140.     '.' [refresh screen] =    @!;
  141.     's'            = @s;
  142.     't'            = @t;
  143.     'u'            = @u;
  144.     'v'            = @v;
  145.     )?
  146.  
  147. [main program]            (
  148.     [create FCB's, open file]     30@F 31@F @G
  149.     [sign-on]             'markov.rec> 'TL
  150.     [automatic compilation]     ('5C'H12wAqt@&3b' 'E(w(@y:;)@w@H;);w);
  151.     [wait, initialize, loop]     RTL @I (@DR
  152.     [exit at once]            ';'=@!;
  153.     [close, exit]            'e'=>@H;
  154.     [read menu]             @?:
  155.     [ignore unknown]        L:);)}
  156.  
  157. [end]
  158.