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

  1.  
  2. { [TURING.REC]
  3. [compile a set of Turing quintuples into a REC program]
  4. [format: (state, symbol, new symbol, new state, direction)]
  5. [Harold V. McIntosh, 1 December 1980]
  6. [Harold V. McIntosh, 22 February 1981]
  7.  
  8. [A Turing machine is a fundamental concept in the theory of computation.
  9.  Although of little practical use, it forms a model of computation which
  10.  is so simple and definite that theorems can be proven about its operation
  11.  allowing rigorous conclusions to be drawn about what is computable and
  12.  what is not. It is Church's thesis that anything which is computable is
  13.  computable by a Turing machine; a statement which cannot be proven but
  14.  which has not been refuted after very extensive analyses of what might
  15.  be meant by computation and ways of performing it. According to Minsky,
  16.  the thesis, in terms of his machine model, is Turing's; Church was
  17.  interested in the general character of an effective computation.]
  18.  
  19. [A Turing machine emulator is of great practical utility for courses in
  20.  Computer Science, because of the concrete experience which it affords
  21.  in understanding the underlying theoretical concepts. Such a program is
  22.  never meant to be efficient; rather the emphasis is upon its pedagogical
  23.  value, in being readily programmable and modifiable, and it the ease and
  24.  clarity of its presentation of the working of a Turing machine.]
  25.  
  26. [One of the best references to Turing machines and their operation is:
  27.  
  28.         Marvin Minsky
  29.         Finite and Infinite Machines
  30.         Prentice-Hall Inc.
  31.         Englewood Cliffs, New Jersey
  32.         (C) 1967.]
  33.  
  34. [The orignal article, which is often cited for the definition of a
  35.  Turing machine, is
  36.  
  37.         Alan M. Turing
  38.         "On computable numbers, with an application
  39.             to the Entscheidungsproblem,"
  40.         Proc. London Math. Soc. (2) 42 230-265 (1936)]
  41.  
  42. [30$ - input FCB]
  43. [31$ - output FCB]
  44.  
  45. [display w/cursor]        (248%I26%TLJZqt248%FD;;) D
  46.  
  47. [erase cursors]         (J(248%FD:JZ;);) E
  48.  
  49. [zero file control block]    ($m33cmpw0%(f:;)wnnS;) F
  50.  
  51. [create input, output FCB's]    ('5C'H12wA' 'Ew;B
  52.   [generate file names]         9aQpG'REC'|m (Z3b' 'E'TNG';Q;)|m w
  53.   [open input file]         n30$rS 30@f
  54.   [open output file]         n31$rS 31@g31@e
  55.                 ;) G
  56.  
  57. [close file]            (
  58.   [clear wkspace, inp file]     @p:L@y:(@p:0=;e26%(f:;)@p;;)
  59.   [close fil.REC]         31$r16k
  60.                  ;) H
  61.  
  62. [initialize]            (J@Wj@!;@!;) I
  63.  
  64. [insert text as read]        (R26%='';T127%(=)(@J|;L@J;);) J
  65.  
  66. [WS up to cursor to disk]    (jJ<(@p:L;)Zz>;) P
  67.  
  68. [read, place in workspace]    (@$@::;)R
  69.  
  70. [17-line window]        (AB(10%EA:;)qL
  71.                   17(d(10%FA;L(26%Fj;Z;)):;)Y<;<) W
  72.  
  73. [open file or create it]    (@h$r15K(255=22K;;)LL;) e
  74.  
  75. [open file or report absence]    (@h$r15K(255='new file 'T;;)LL;) f
  76.  
  77. [delete file if present]    (@h$r19k;) g
  78.  
  79. [CP/M's DMA address]        ('80'H26k;) h
  80.  
  81. [write one record]        (@Ej((26%EZD0;128(a);))qL26k31$r21kD'.'TL;) p
  82.  
  83. [Turing subroutines]        ("{
  84.   [head right]            (AAB;'.'I;;)+
  85.   [head left]            (B;j'.'I;;)-
  86.   [head stationary]        (;)0
  87.   [test equality]        (pGm=n;nL)=
  88.   [cr.lf]            (2573TL;)&
  89.   [read phrase]            (R13%='';08%(=)(T@J|;08%T' 'TLTLL@J;);)J
  90.   [sign-on message]        ('[[]]'TL@&'Initial Tape:'TL@&@JJZDI'#'FD;:)R
  91.   [write tape segment]        (j(20b;J;)qtz' 'TABqtTLz(20a;LZ;)qtB;) W
  92.                 "I;) s
  93.  
  94. [Turing quintuple]        ('('F39%I
  95.                  ','FD39%I'@='I39%I
  96.                  ','FD39%I'E;)D'I39%I
  97.                  ','FD39%I'IL'I39%I
  98.                  ','FD39%I'@'I
  99.                  ')'FD':'I
  100.                 ;;) t
  101.  
  102. [Turing preface]        ("(@R'Q0'(@&@WRLT"I2573I;;) u
  103.  
  104. [Turing postscript]        (2573I"'H'=;);)}"I;) v
  105.  
  106. [compile a TURING file]        (Jj
  107.   [change file extension]      ('.TNG]'FD'.REC]'Iz;;)
  108.   [find display message]      ('[['F']]'UQD;'';)
  109.   [look for code gap]          ('('Ej;2573Ez2573Ez2573Ez2573Ej2bD;A:;)
  110.   [insert preface; to disk]      's'TL@s<'[[]]'FDIZ>@uz@P
  111.   [compile each function]      ('t'TL@tz@P'('Fj:;)
  112.   [insert postscript]          'u'TL@vz@P
  113.                 ;) w
  114.  
  115. [append a record]        (128(e)L;qL26k30$r20K0=L;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;;) 2
  122.  
  123. [cr,lf]                (2573TL;) &
  124.  
  125. [read w/error correction]    (RT08%=127%;13%=2573;26%(=);) $
  126.  
  127. [clear screen]            (26%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] =        @J@!;
  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.     11% [up arrow] =    (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.     ) ?
  157.  
  158. [main program]            (
  159.   [create FCB's, open file]     30@F 31@F @G
  160.   [sign-on]             'turing.rec> 'TL
  161.   [automatic compilation]     ('5C'H12wAqt@&3b' 'E(w(@y:;)@w@H;);w);
  162.   [wait, initialize, loop]     RTL @I (@DR
  163.     [exit at once]             ';'=@!>;
  164.     [close,exit]             'e'=>@H;
  165.     [read menu]              @?:
  166.     [ignore unknown]             L:);)}
  167.  
  168. [end]
  169.