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

  1.  
  2. { [POST.REC]
  3. [Compile a set of Post productions into a REC program]
  4. [Harold V. McIntosh, 7 December 1980]
  5. [Harold V. McIntosh, 22 February 1981]
  6. [Harold V. McIntosh, 28 December 1983]
  7.  
  8.  
  9. [Post productions strongly resemble the proofs that have traditionally
  10.  characterized high school courses in Euclidean geometry.  Some initial
  11.  premise - an axiom - is to be transformed by a chain of substitutions
  12.  into a conclusion - a theorem.  A distinguishing feature of Post's rules
  13.  of transformation is that the text, or phrases to be manipulated, are
  14.  not spelled out explicitly.  Rather, they are defined by their context,
  15.  meaning, by the phrases immediately preceding or following them.]
  16.  
  17. [Post's ideas are to be found in a couple of journal articles.  A really
  18.  excellent presentation of his work occupies a great part of Minsky's
  19.  book, derived from his own lecture notes at MIT:
  20.  
  21.         Marvin Minsky
  22.         Finite and Infinite Machines
  23.         Prentice-Hall Inc.
  24.         Englewood Cliffs, New Jersey
  25.         (C) 1967.]
  26.  
  27. [It is possible to define a system, which does not strictly follow
  28.  Post's original plan, but which is nevertheless algorithmic and which
  29.  illustrates many of the ideas and captures much of the spirit behind
  30.  his formalization of computation.  Such a program was a precursor to
  31.  CONVERT.  Yet a different approach to a computational scheme led A. A.
  32.  Markov to his algorithms, which constitute another technique upon which
  33.  a theory of computation may be based.]
  34.  
  35. [30$ - input FCB]
  36. [31$ - output FCB]
  37.  
  38. [display w/cursor]        (248%I26%TLJZqt248%FD;;) D
  39.  
  40. [erase cursors]            (J(248%FD:JZ;);) E
  41.  
  42. [zero file control block]    ($m33cmpw0%(f:;)wnnS;) F
  43.  
  44. [create input, output FCB's]    ('5C'H12wA' 'Ew;B
  45.   [generate file name]         9aQpG'REC'|m (Z3b' 'E'PST';Q;)|m w
  46.   [open input file]         n30$rS 30@f
  47.   [open output file]         n31$rS 31@g31@e
  48.                 ;) G
  49.  
  50. [close file]            (
  51.   [clear wkspace, inp file]     '.'TL@p:L@y:(@p:0=;e26%(f:;)@p;;)
  52.   [close fil.REC]         31$r16k
  53.                  ;) H
  54.  
  55. [initialize]            (J@Wj@!;@!;) I
  56.  
  57. [read, with rubout]        (R26%='';T127%(=)(@J|;L@J;);) J
  58.  
  59. [WS up to cursor to disk]    (jJ<(@p:L;)Zz>;) P
  60.  
  61. [compile a POST file]        (Jj
  62.   [change file extension]      ('.PST]'FD'.REC]'Iz;;)
  63.   [find display message]      ('[['F']]'UQD;'';)
  64.   [look for code gap]          ('('Fj;2573Ez2573Ez2573Ez2573Ej2bD;A:;)
  65.   [insert preface; to disk]      's'TL@s<'[[]]'FDIZ>@uz@P
  66.   [compile each function]      ('t'TL@tz@P'('Fj:;)
  67.   [insert postscript]          'u'TL@vz@P
  68.                 ;) Q
  69.  
  70. [read, place in workspace]    (@$@::;) R
  71.  
  72. [15-line window]        (AB(10%EA:;)qL
  73.                   15(d(10%FA;L(26%Fj;Z;)):;)Y<;<) W
  74.  
  75. [parse antecedent]        (j39%I'<'(F;ZD)D39%I'E'I
  76.                  '>'UQD'>'ED ('<'U;Z;)Qj
  77.                  (''='@Z';39%II39%I'@U';)II
  78.                  '$S('I z(@a 'nL;nL)'I;z;);
  79.                  >','FD')'U<@b';)'I) a
  80.  
  81. [parse consequent]        (Jj2573I09%I'JZD'I39%I ('<'FD39%I'I'I
  82.                 '>'FD'$ryGI'I39%I:;)Zz39%I'I'I
  83.                 ;) b
  84.  
  85. [open file or create it]    (@h$r15K(255=22K;;)LL;) e
  86.  
  87. [open file or report absence]    (@h$r15K(255='new file 'T;;)LL;) f
  88.  
  89. [delete file if present]    (@h$r19k;) g
  90.  
  91. [CP/M's DMA address]        ('80'H26k;) h
  92.  
  93. [write one record]        (@Ej((26%EZD0;128(a);))qL26k31$r21kD'.'TL;) p
  94.  
  95. [Post subroutines]        ("{
  96.     [cr, lf]            (2573TL;)&
  97.     [read console]        (R13%='';T08%(=2080[sp,bs]TL)(@J|;L@J;);)J
  98.     [logon message]        ('[[]]'TL@&'Initial Axiom:'TL@&@JI;:)R
  99.     [to shorten program]    (UQzml;)U
  100.     [write workspace]        (JZqt;)W
  101.     [to shorten program]    (zZQml;)Z
  102.     [signoff message]        (@&'Theorem:'TL@&JZqt;)X
  103.                 "I;) s
  104.  
  105. [Post production]        ('('FD'JZ'I','U<@a>z')'FD'nL:'I;;) t
  106.  
  107. [Post preface-stand alone]    ('(@R(@&@WRL'I2573I;) u
  108.  
  109. [Post postscript-s.a.]        (';)@X;)}'I;) v
  110.  
  111. [Post preface-subroutine]    ('(@&JZqt'I;) w
  112.  
  113. [Post postscript-subr]        (';)=;'I;) x
  114.  
  115. [append a record]        (128(e)L;qL26k30$r20K0=L@h;DLL@h) y
  116.  
  117. [back to line feed]        (10%Ez;B:j;) 0
  118.  
  119. [bracket a line]        (@010%V;Z;) 1
  120.  
  121. [back to preceding line]    (@0BB@0;;i) 2
  122.  
  123. [cr,lf]                (2573TL;i) &
  124.  
  125. [read w/error correction]    (RT95%=127%;13%=2573;26%(=);) $
  126.  
  127. [clear screen]            (12%TL;) !
  128.  
  129. [erase on ro, insert others]    (127%=z(B;;)D;I;) :
  130.  
  131. [form next window]        (Zz>@W@!;) >
  132.  
  133. [cancel line]            (24%TL;) ^
  134.  
  135. (    'd' [delete] =        (ABD;;);
  136.     'i' [insert] =        (@D@$@::;)@!;
  137.     'j' [beginning] =    Jj;
  138.     'x' [exchange] =    (ABD;;)RTI;
  139.     'z' [to end] =        Z;
  140.     127%[delete] =        @1D@!;
  141.     124%[ver bar: next] =    (10%FA;J>(10%FA;;)@Wz@!;;);
  142.     13% [carr ret] =    @0;
  143.     96% [prime: up line] =    (BA@2;J>@2@Wj@!;;);
  144.     95% [undrscore: back] =    (Bj;;);
  145.     'n' [next record] =    >(@p;L;)(@y;;)J(@W;;);
  146.     'p' [write 1 record] =    >(@p;L;)J(@W;;);
  147.     'y' [read 1 record] =    >(@y;'eof:'TL;)J(@W;;);
  148.     ' ' [advance] =        (A;;);
  149.     '>' [next window] =    (@>j;>@I;);
  150.     '<' [beg window] =    >@I;
  151.     '.' [refresh screen] =    @!;
  152.     's'            = @s;
  153.     't'            = @t;
  154.     'u'            = @u;
  155.     'v'            = @v;
  156.     'U'            = @w;
  157.     'V'            = @x;
  158.     ) ?
  159.  
  160. [main program]            (
  161.     [open FCB's, open files]     30@F 31@F @G
  162.     [sign-on]             'post.rec> 'TL
  163.     [automatic compilation]     ('5C'H12wAqt@&3b' 'E(w(@y:;)@Q@H;);w);
  164.     [wait, initialize, loop]     RTL @I (@DR
  165.     [exit at once]             ';'=@!;
  166.     [close, exit]             'e'=>@H;
  167.     [read menu]             @?:
  168.     [ignore unknown]         L:);)}
  169.  
  170. [end]
  171.