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

  1.  
  2. [PRGRM.CNV]
  3. [CNVRT Program and Function Definition compiler for "C"]
  4. [Harold V. McIntosh, 10 June 1983]
  5.  
  6.  
  7.  
  8. [compile programs and functions]
  9. ((
  10.   [program]      (<:1:>(or,<:0:>,)) 0
  11.   [ext defn]      ((or,<:~:>,<:2:>)) 1
  12.   [funct def]      ((or,<:X:>,)<:!:><:%:>) 2
  13.   [beware of a function of no arguments - M tries to pick it up]
  14.   [funct declr]      (<:M:>(or,<(><:$:><)>,)) !
  15.   [param list]      (<:I:>(or,<,> <:$:>,)) $
  16.   [funct body]      (<:.:><:^:>) %
  17.   [declr list]      ((or,<:Z:><:.:>,)) .
  18.   [stmnt list]      ((or,statement<:-:>,)) -
  19.   [funct stmnt]      ({<:.:><:-:>}) ^
  20.   [data defn]      ((or,extern,static)(or, <:X:>,)(or, <:V:>,);) ~
  21.  
  22.     )()(0 1 2)(
  23.         (<:0:>,yes);
  24.         (,no);
  25.   )) u
  26.  
  27. [compile declaration]
  28. ((
  29.   [declaration]      (<:Y:>(or, <:V:>,);) Z
  30.   [decl spec]      ((or,<:X:>(or, <:W:>,),<:W:>(or, <:X:>,))) Y
  31.   [s. c. spec]      ((or,<<
  32.             >>char,<<
  33.             >>(or,long ,short ,unsigned ,)int,<<
  34.              >>(or,long ,)float,<<
  35.             >>double,<<
  36.             >><:H:>,<<
  37.             >>tdefname)) X
  38.   [type spec]      ((or,<<
  39.             >>auto,<<
  40.             >>static,<<
  41.             >>extern,<<
  42.             >>register,<<
  43.             >>typedef)) W
  44.   [in dcl lst]      (<:U:>(or,<,> <:V:>,)) V
  45.   [init decl]      (<:M:>(or, <:6:>,)) U
  46.   [d-extender]      ((or,<(><)>,[<:o:>],[])) Q
  47.   [d-extender*]      ((or,<:Q:><:S:>,)) S
  48.   [declarator]      ((or,<:I:>,<(><:M:><)>,*<:M:>)<:S:>) M
  49.   [s or u spec]      ((or,struct,union)(or, <:I:>,)(or, {<:G:>},)) H
  50.   [st decl lst]      (<:9:>(or, <:G:>,)) G
  51.   [st decl]      (<:X:><:8:>;) 9
  52.   [st dcl list]      ( <:7:>(or,<,><:8:>,)) 8
  53.   [str. declr]      ((or,<:M:>:<:o:>,<:M:>,:<:o:>)) 7
  54.   [initializer]      (= (or,<:E:>,{<:5:>(or,<,>,)})) 6
  55.   [init. list]      ((or,<:E:>,{<:5:>})(or,<,> <:5:>,)) 5
  56.   [type-name]      (<:X:><:3:>) 4
  57.   [abst. decl]      ((or,<(><:3:><)>,*<:3:>)<:S:>,)) 3
  58.  
  59.   )()(0 1 2)(
  60.  
  61.   [prnt WS]      ((PWS)<>,);
  62.         (<0>,(u,<0>));
  63.           ((and,<:Y:>,<0>)(and,(or, <:V:>,),<1>);,<<
  64.             >>/definition (z,<1><,>) %%% <0><<
  65.             >>/initialize (y,<1><,>)<<
  66.             >>);
  67.           (<:Z:>,yes);
  68.           (,no);
  69.   )) w
  70.  
  71. [token compilation of expressions]
  72. (()()(0)(
  73.         (<0>,/compiled <0>);
  74.   )) x
  75.  
  76. [split out initializations]
  77. (()()(0 1 2)(
  78.         ((and, <:M:> <:6:><,>,<0>)<1>,<0>(y,<1>));
  79.         ( <:M:><,><0>,<0>):
  80.   )) y
  81.  
  82. [remove initializations leaving definitions]
  83. (()()(0 1 2)(
  84.         ((and, <:M:>, <0>)(or, <:6:>,)<,><1>, <0><,>(z,<1>));
  85.   )) z
  86.  
  87. [main program including syntactic elements]
  88. ( (
  89.   [alfanum]   ((and,<[1]>,(IVL, ,~,))) a
  90.   [letter]    ((and,<[1]>,(or,(IVL,A,Z,),(IVL,a,z,),_))) b
  91.   [odigit]    ((and,<[1]>,(IVL,0,7,))) c
  92.   [ddigit]    ((and,<[1]>,(IVL,0,9,))) d
  93.   [hdigit]    ((and,<[1]>,(or,(IVL,0,9,),(IVL,A,F,),(IVL,a,f,)))) e
  94.   [astring]   ((or,(or,\<:a:>,(and,<:a:>,(NOT,(or,<">,<'>,\))))<:f:>,)) f
  95.   [ostring]   ((or,<:c:><:g:>,)) g
  96.   [dstring]   ((or,<:d:><:h:>,)) h
  97.   [hstring]   ((or,<:e:><:i:>,)) i
  98.   [cconst]    ((or,\<:a:>,<'><:a:><'>)) j
  99.   [iconst]    ((or,0(or,X,x)<:i:>,0<:g:>,<:d:><:h:>)) k
  100.   [fconst]    (<:h:>.<:h:>(or,(or,E,e)(or,+,-,)<:h:>,)) l
  101.   [sconst]    (<"><:f:><">) m
  102.   [cstring]   ((or,(or,<:b:>,<:d:>)<:n:>,)) n
  103.   [constant]  ((or,<:l:>,<:k:>,<:j:>,<:m:>)) o
  104.   [identifier](<:b:><:n:>) I
  105.   [aoperator] ((or,=,+=,-=,*=,/=,%=,(QUO/>>=/),(QUO/<<=/),&=,^=,|=)) p
  106.   [boperator] ((or,*,/,%,+,-,(QUO/>>/),(QUO/<</),(QUO/<=/),<<
  107.         >>(QUO/>=/),(<),(>),==,!=,&&,^,||,&,|)) q
  108.   [uoperator] ((or,*,&,-,!,~,sizeof,<(>typename<)>)) r
  109.   [uoper*]      ((or,<:r:><:s:>,)) s
  110.   [lvalue]    ((or,<<
  111.         >>(and,<:P:>,<-->[<:E:>]<>),<<
  112.         >>(and,<:P:>,<-->-(>)<:I:><>),<<
  113.         >>(and,<:P:>,<-->.<:I:><>),<<
  114.         >><:I:>,<<
  115.         >>*<:E:>,<<
  116.         >><(><:L:><)>)) L
  117.   [pexten]    ((or,[<:E:>],<(><:F:><)>,-(>)<:I:>,.<:I:>)) N
  118.   [pextn*]    ((or,<:N:><:O:>,)) O
  119.   [primary]   ((or,<:I:>,<:o:>,<(><:E:><)>)<:O:>) P
  120.   [eroot]     ((or,<<
  121.         >><:r:><:A:>,<<
  122.         >>++<:L:>,<<
  123.         >>--<:L:>,<<
  124.         >><:L:>++,<<
  125.         >><:L:>--,<<
  126.         >><:P:>)) A
  127.   [bexpr]     (<:A:>(or,<:q:><:B:>,)) B
  128.   [cexpr]     (<:B:>(or,?<:K:>:<:K:>,)) K
  129.   [aexpr]     ((or,<:L:><:p:><:D:>,<:K:>)) D
  130.   [expression](<:D:>(or,<,><:E:>,)) E
  131.   [e-list]    ((or,<:E:><:F:>,)) F
  132.   )  ()(0)(  
  133.     (;,done);
  134.     (<0>,(%C,(w,<0>))(%R)):
  135.   ))
  136.  
  137. [end]
  138.