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

  1.  
  2. [DCLRN.REC]
  3. [CNVRT compiler for "C" Declarations]
  4. [Harold V. McIntosh, 10 June 1983]
  5.  
  6. {
  7.                    {
  8.     [find/make FCB]        (Jj'TTY:'EQZD;(':'UQD':'ED\64-%;0%;)
  9.                  ('.'U<(8a;@b;)Q|D>;Z'.DAT'IJj:)
  10.                   '.'FJDZ(3a;@b;)Q|JZDI
  11.                  32(dpGm$r0=npGpGd0&$Sm@znpGQ&$rrS0;
  12.                  r12wQmwnEn;n:)D;) f
  13.     [blank fill by count]    (Zz(d' 'I:;)JZ;) b
  14.     [zero fill]            (cmpw0%(f:;)w;) 0
  15.     [zero FCB & buffer]        ($m33@0130@0nn&0||pLnS;) z
  16.     [set default input file]    (0,30$S'5C'H12wA' 'Ew4@0n0|0|pL31$S
  17.                  'TTY:'31$rrS; B9aQD(3a'   'E
  18.                  'DAT';Q;)|mw31@zn31$rrS31@r;) i
  19.     [open for read]        (@hr15K(255='NO FILE'I;L;)L;) r
  20.     [open for write]        (@hpGpG4+1&SrpG19k22k^^r128&S;) w
  21.     [set DMA address]        ($rpG^^r^^26k;) h
  22.     [open]            (m@f0=n@@;nLL;) O
  23.     [read]            (''(AL@f(0=pG@r;'TTY:'(='T');))
  24.                  ('T'='';L31pG$rr12w'TTY:'Ew;w)
  25.                  L@&'> 'TL(@#I;:);
  26.                  $r(pG^^rpGmr(0=(npGpGm128&S^^26kpGr
  27.                  20K0=L;LL1npGpGm129+26%&SS;)npGmr;;)
  28.                  pG130&-n+&dm(u13%=;10%(=)pGI(26%=;
  29.                  L);ndm:)L^^rn&S;LpG^^r0&S:);) R
  30.     [write]            (Jj'='U<(A@f'TTY:'(=)(0=pG@w;;))>'='ED
  31.                  ZqtD; >'='EDZ<@g;) W
  32.     [write to disk]        ($r(pG^^rpGpGmrpGm- 130+n&maQD>Z<nSn^^
  33.                  26kpGr21kpG^^r128&S:JZQD>nSnSL;);) g
  34.     [close all files]        (31pGm($r0=;pG4+r(0=L;LJj26%I<npGm@gpG
  35.                  ^^rpGr127(N^^26kpGr21k;L;)r16k;)ndpGm:)
  36.                  nL;;) c
  37.     [PVR]            (pG@&#'= '|TL$r(0='undef';yG;)TL;) _
  38.     [cr, lf]            (2573TL;)&
  39.     [insert cr, lf]        (2573I;)|
  40.     [read console]        (R13%='';T08%(=)(@#|;2080[sp,bs]TLL@#;);)#
  41.     [type comment]        (@TD;)C
  42.     [display at logon]        ('cnvrt/icuap/1983'TL@&;)D
  43.     [write workspace]        (@&JZqt;)T
  44.                 (@@;) }%
  45.     [integer arithmetic]    {(+;)+ (-;)- (*;)* (/&L;)/
  46.                 (pGm/L1=nL1;0=n;n&:)|
  47.                  ((pGmJj(U);QD(O)I;npGmEDZQD(O)IjnpGmI;
  48.                  n@@#I)nLJZ;;) } #
  49.     [save & init variables]    (pGpGm$rm0&$S;) (
  50.     [reinitialize variable]    (pG$r0=L;LnL0&$S;) :
  51.     [undefine variable]        ($r0=;LnL;) )
  52.     [compare/define variable]    (pG$r0=ZQzml&$S;&LyGEz;) ]
  53.     [body of variable search]    (pG$r(0=)yG(E;&L)z&L@=L;pG$r(0=;LL)
  54.                   Z<((&pGm&n(F;''mZz<)jJQmpGl&$S
  55.                   zZ<@=>;J>);nLA:0&$SL>)>LL;) >
  56.     [body of variable search]    (pG$r(0=)yGEz@=L;pG$r(0=;LL)
  57.                   Z<((jJQmpGl&$S
  58.                   zZ<@=>;J>);nLA:0&$S>)>L;) <
  59.     [insert variable]        ($ryGI;) [
  60.                 
  61. [compile declaration]
  62. {
  63.   [declaration]      (@Y [or] Z<(' 'Ez@V; J;>)> [or] ';'Ez;) Z
  64.   [decl spec]      ( [or] Z<(@X [or] Z<(' 'Ez@W; J;>)> [or] ; J@W [or] Z<(' 'Ez@X; J;>)> [or] ;>)> [or] ;) Y
  65.   [s. c. spec]      ( [or] Z<('char'Ez; J [or] Z<('long 'Ez; J'short 'Ez; J'unsigned 'Ez; J;>)> [or] 'int'Ez; J [or] Z<('long 'Ez; J;>)> [or] 'float'Ez; J'double'Ez; J@H; J'tdefname'Ez;>)> [or] ;) X
  66.   [type spec]      ( [or] Z<('auto'Ez; J'static'Ez; J'extern'Ez; J'register'Ez; J'typedef'Ez;>)> [or] ;) W
  67.   [in dcl lst]      (@U [or] Z<(', 'Ez@V; J;>)> [or] ;) V
  68.   [init decl]      (@M [or] Z<(' 'Ez@6; J;>)> [or] ;) U
  69.   [d-extender]      ( [or] Z<('()'Ez; J'['Ez@o']'Ez; J'[]'Ez;>)> [or] ;) Q
  70.   [d-extender*]      ( [or] Z<(@Q@S; J;>)> [or] ;) S
  71.   [declarator]      ( [or] Z<(@I; J'('Ez@M')'Ez; J'*'Ez@M;>)> [or] @S;) M
  72.   [s or u spec]      ( [or] Z<('struct'Ez; J'union'Ez;>)> [or]  [or] Z<(' 'Ez@I; J;>)> [or]  [or] Z<(' {'Ez@G'}'Ez; J;>)> [or] ;) H
  73.   [st decl lst]      (@9 [or] Z<(' 'Ez@G; J;>)> [or] ;) G
  74.   [st decl]      (@X@8';'Ez;) 9
  75.   [st dcl list]      (' 'Ez@7 [or] Z<(','Ez@8; J;>)> [or] ;) 8
  76.   [str. declr]      ( [or] Z<(@M':'Ez@o; J@M; J':'Ez@o;>)> [or] ;) 7
  77.   [initializer]      ('= 'Ez [or] Z<(@E; J'{'Ez@5 [or] Z<(','Ez; J;>)> [or] '}'Ez;>)> [or] ;) 6
  78.   [init. list]      ( [or] Z<(@E; J'{'Ez@5'}'Ez;>)> [or]  [or] Z<(', 'Ez@5; J;>)> [or] ;) 5
  79.   [type-name]      (@X@3;) 4
  80.   [abst. decl]      ( [or] Z<('('Ez@3')'Ez; J'*'Ez@3;>)> [or] @S','Ez;) 3
  81.  
  82.   )(0@( 1@( 2@( {(0@: 1@: 2@: ;); (
  83.  
  84.   [prnt WS]      @;(J2573TLZqtj(A)JZD;);
  85.           @;(J [and] Z<(@Y jJ><0@](A);>)> [and]  [and] Z<( [or] Z<(' 'Ez@V; J;>)> [or]  jJ><1@](A);>)> [and] ';'EzJZD'/definition 'Iz<1@[','I@zZ>' %%% 'I0@['/initialize 'Iz<1@[','I@yZ>;);
  86.           @;(J@ZJZD'yes'I;);
  87.           @;(JJZD'no'I;);
  88.   ;)} 0@) 1@) 2@)   nn$S nn$S nn$S;)} w
  89.  
  90. [token compilation of expressions]
  91. {(0@( {(0@: ;); (
  92.         @;(J0@]JZD'/compiled 'I0@[;);
  93.   ;)} 0@)   nn$S;)} x
  94.  
  95. [split out initializations]
  96. {(0@( 1@( 2@( {(0@: 1@: 2@: ;); (
  97.         @;(J [and] Z<(' 'Ez@M' 'Ez@6','Ez jJ><0@](A);>)> [and] 1@]JZD0@[z<1@[@yZ>;);
  98.         @;(J' 'Ez@M','Ez0@]JZD0@[;):
  99.   ;)} 0@) 1@) 2@)   nn$S nn$S nn$S;)} y
  100.  
  101. [remove initializations leaving definitions]
  102. {(0@( 1@( 2@( {(0@: 1@: 2@: ;); (
  103.         @;(J [and] Z<(' 'Ez@M jJ><' 'Ez0@](A);>)> [and]  [or] Z<(' 'Ez@6; J;>)> [or] ','Ez1@]JZD' 'I0@[','Iz<1@[@zZ>;);
  104.   ;)} 0@) 1@) 2@)   nn$S nn$S nn$S;)} z
  105.  
  106. [main program including syntactic elements]
  107.   [alfanum]   ( [and] Z<(1(a;L)z jJ><' ''~'Mz(A);>)> [and] ;) a
  108.   [letter]    ( [and] Z<(1(a;L)z jJ>< [or] Z<('A''Z'Mz; J'a''z'Mz; J'_'Ez;>)> [or] (A);>)> [and] ;) b
  109.   [odigit]    ( [and] Z<(1(a;L)z jJ><'0''7'Mz(A);>)> [and] ;) c
  110.   [ddigit]    ( [and] Z<(1(a;L)z jJ><'0''9'Mz(A);>)> [and] ;) d
  111.   [hdigit]    ( [and] Z<(1(a;L)z jJ>< [or] Z<('0''9'Mz; J'A''F'Mz; J'a''f'Mz;>)> [or] (A);>)> [and] ;) e
  112.   [astring]   ( [or] Z<( [or] Z<('\'Ez@a; J [and] Z<(@a jJ><[not] (Z<  [or] Z<(34%Ez; J39%Ez; J'\'Ez;>)> [or] J>)J>[not] Zz(A);>)> [and] ;>)> [or] @f; J;>)> [or] ;) f
  113.   [ostring]   ( [or] Z<(@c@g; J;>)> [or] ;) g
  114.   [dstring]   ( [or] Z<(@d@h; J;>)> [or] ;) h
  115.   [hstring]   ( [or] Z<(@e@i; J;>)> [or] ;) i
  116.   [cconst]    ( [or] Z<('\'Ez@a; J39%Ez@a39%Ez;>)> [or] ;) j
  117.   [iconst]    ( [or] Z<('0'Ez [or] Z<('X'Ez; J'x'Ez;>)> [or] @i; J'0'Ez@g; J@d@h;>)> [or] ;) k
  118.   [fconst]    (@h'.'Ez@h [or] Z<( [or] Z<('E'Ez; J'e'Ez;>)> [or]  [or] Z<('+'Ez; J'-'Ez; J;>)> [or] @h; J;>)> [or] ;) l
  119.   [sconst]    (34%Ez@f34%Ez;) m
  120.   [cstring]   ( [or] Z<( [or] Z<(@b; J@d;>)> [or] @n; J;>)> [or] ;) n
  121.   [constant]  ( [or] Z<(@l; J@k; J@j; J@m;>)> [or] ;) o
  122.   [identifier](@b@n;) I
  123.   [aoperator] ( [or] Z<('='Ez; J'+='Ez; J'-='Ez; J'*='Ez; J'/='Ez; J'%='Ez; J'>>='Ez; J'<<='Ez; J'&='Ez; J'^='Ez; J'|='Ez;>)> [or] ;) p
  124.   [boperator] ( [or] Z<('*'Ez; J'/'Ez; J'%'Ez; J'+'Ez; J'-'Ez; J'>>'Ez; J'<<'Ez; J'<='Ez; J'>='Ez; J'<'Ez; J'>'Ez; J'=='Ez; J'!='Ez; J'&&'Ez; J'^'Ez; J'||'Ez; J'&'Ez; J'|'Ez;>)> [or] ;) q
  125.   [uoperator] ( [or] Z<('*'Ez; J'&'Ez; J'-'Ez; J'!'Ez; J'~'Ez; J'sizeof'Ez; J'(typename)'Ez;>)> [or] ;) r
  126.   [uoper*]      ( [or] Z<(@r@s; J;>)> [or] ;) s
  127.   [lvalue]    ( [or] Z<( [and] Z<(@P jJ><(('['(Fz;Zz<)Z<@E']'Ez(A)>;J>);A:)(A);>)> [and] ; J [and] Z<(@P jJ><(('-'(Fz;Zz<)Z<'>'Ez@I(A)>;J>);A:)(A);>)> [and] ; J [and] Z<(@P jJ><(('.'(Fz;Zz<)Z<@I(A)>;J>);A:)(A);>)> [and] ; J@I; J'*'Ez@E; J'('Ez@L')'Ez;>)> [or] ;) L
  128.   [pexten]    ( [or] Z<('['Ez@E']'Ez; J'('Ez@F')'Ez; J'->'Ez@I; J'.'Ez@I;>)> [or] ;) N
  129.   [pextn*]    ( [or] Z<(@N@O; J;>)> [or] ;) O
  130.   [primary]   ( [or] Z<(@I; J@o; J'('Ez@E')'Ez;>)> [or] @O;) P
  131.   [eroot]     ( [or] Z<(@r@A; J'++'Ez@L; J'--'Ez@L; J@L'++'Ez; J@L'--'Ez; J@P;>)> [or] ;) A
  132.   [bexpr]     (@A [or] Z<(@q@B; J;>)> [or] ;) B
  133.   [cexpr]     (@B [or] Z<('?'Ez@K':'Ez@K; J;>)> [or] ;) K
  134.   [aexpr]     ( [or] Z<(@L@p@D; J@K;>)> [or] ;) D
  135.   [expression](@D [or] Z<(','Ez@E; J;>)> [or] ;) E
  136.   [e-list]    ( [or] Z<(@E@F; J;>)> [or] ;) F
  137.     (0@( {(0@: ;); (  
  138.     @;(J';'EzJZD'done'I;);
  139.     @;(J0@]JZDz<z<0@[@wZ>'C'@%Z>z<'R'@%Z>;):
  140.   ;)} 0@)   nn$S;)} ~
  141. ('i'@%'D'@%'R'@%@~JZqt'c'@%;)  }
  142.  
  143. [end]
  144.