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

  1.  
  2. [RECCOM.CNV]
  3. [CNVRT compiler for REC]
  4. [a version which compiles "assembler" code]
  5. [Harold V. McIntosh, 28 April 1982]
  6. [Harold V. McIntosh, 2 June 1983]
  7. [Harold V. McIntosh, 28 December 1983]
  8.  
  9. [[
  10. Compile a REC expression into a very stylized assembly
  11. language program, which can nevertheless be assembled
  12. by a specialized assembler. Either type an expression
  13. to be compiled, using parentheses and braces, or two
  14. file names, as =INPUT,OUTPUT. If INPUT.DAT has a REC
  15. program, it will be compiled and placed in OUTPUT.DAT.
  16. Only one file may be processed in a given session, but
  17. several examples may be input from the console. Type a
  18. single carriage return to quit.
  19. ]]
  20.  
  21.  
  22.  
  23. [individual cases]
  24. (()()(0 1)(
  25.         ((PWS,A:)(or),);
  26.         (<>,);
  27.   [space, <,>]  ((or, ,<,>)<0>,<0>):
  28.   [number]    ((and,<:c:>,<0>)<1>,/call NU/db   <'><0><'>(A,<1>));
  29.   [quote]    ((and,(or,<:e:>,<:f:>),<0>)<1>,/call QU/db   <0>(A,<1>));
  30.   [arroba]    (@(and,<[1]>,<0>)<1>,/call AR/db   <'><0><'>(A,<1>));
  31.   [comment]    (<:d:><0>,<0>):
  32.   [operator]    ((and,<:o:>,<0>)<1>,/call op$<0>(A,<1>));
  33.   [predicate]    ((and,<:p:>,<0>)<1>,/call pr$<0>/jmp  #(A,<1>));
  34.   [colon]    (:<1>,/jmp  %/#:(A,<1>));
  35.   [semicolon]    (;<1>,/jmp  $/#:(A,<1>));
  36.   [parenthesis]    ((and,<:i:>,<(><0><)><>)<1>,/%:(A,<0>)/jmp  ##/$:/#:(A,<1>));
  37.   [brace]    ((and,<:j:>,{<0>})<1>,<<
  38.           >>/call main/jmp  #/jmp  $(B,[]<0>)(A,<1>)/$:);
  39.   [more source] (<0>,<0>(C,(R))):
  40.   )) A
  41.  
  42. [string of definitions inside braces]
  43. (()()(0 1 2 3)(
  44.         ((PWS,B:)(or),);
  45.   [main]    ([<0>](and,(or,<:i:>,<:j:>),<1>) (and,<:a:>,<2>) <3>,<<
  46.           >>/<2>:(A,<1>)(E)(B,[<0>(p,<2>)]<3>)(q,<2>));
  47.   [subroutines]    ([<0>](and,(or,<:i:>,<:j:>),<1>),<<
  48.           >>/pprg:(A,<1>)(E)/main:<0>/call pprg(r));
  49.   )) B
  50.  
  51. [exclude the portion of a file following ^Z]
  52. (()()(0)((<0>(CTL,Z),<0>);)) C
  53.  
  54. [push macro]
  55. (()()(0)((<0>,/lhld t$<0>/xthl/push h/lxi  h,<0>:/shld t$<0>);)) p
  56.  
  57. [pop macro]
  58. (()()(0)((<0>,/pop  h/xthl/shld t$<0>);)) q
  59.  
  60. [macro to transfer skip to stack]
  61. (()()()((,/jmp  $$/xthl/inx  h/inx  h/inx  h/xthl/$$:);)) r
  62.  
  63. [main program]
  64. ((
  65.   [alfanum]  ((and,<[1]>,(IVL, ,~,))) a
  66.   [numeric]  ((and,<[1]>,(IVL,0,9,))) b
  67.   [number]   ((or,-,)<:b:>(ITR,<:b:>)) c
  68.   [comment]  ([(ITR,(or,<:d:>,(and,<[1]>,(nor,[,]))))]) d
  69.   [s-quote]  (<'>(ITR,(or,<:e:>,<:f:>,(and,<[1]>,(nor,<'>,<">))))<'>) e
  70.   [d-quote]  (<">(ITR,(or,<:e:>,<:f:>,(and,<[1]>,(nor,<'>,<">))))<">) f
  71.          ((or,<:c:>,<:d:>,<:e:>,<:f:>,@<[1]>,<:i:>,<:j:>)) g
  72.          ((and,<[1]>,(nor,<(>,<)>,{,},[,],@,<'>,<">))) h
  73.   [paren]    (<(>(ITR,(or,<:g:>,<:h:>))<)>) i
  74.   [brace]    ({(ITR,(or,<:g:>,<:h:>))}) j
  75.   [oper]     ((or,!,#,$,%,&,*,+,/,(<),(>),D,G,I,J,K,L,<<
  76.         >>P,Q,R,S,T,W,X,Z,\,^,_,c,(IVL,g,z,),|,~)) o
  77.   [pred]     ((or,=,?,A,B,C,E,F,H,M,O,U,V,`,a,b,d,e,f)) p
  78.  
  79.   )(
  80.          ((%R,<8>)) R
  81.          (/skip/#:/ret) E
  82.   )(0 8 9)(
  83.     ((or,<>,;),goodbye);
  84.     (=<8><,><9>,(%Or,<8>)(%Ow,<9>)(%W,<9>=(%T,(A,(R)(R))(E)))(%E));
  85.     (<0>,(%C,(A,<0>)(E))(%R)):
  86.   ))
  87.  
  88. [end]
  89.