home *** CD-ROM | disk | FTP | other *** search
-
- [STMNT.CNV]
- [CNVRT compiler for "C" Statements]
- [Harold V. McIntosh, 10 June 1983]
-
-
-
- [compile statement]
- ((
- [statement] ((or,<<
- [if-else] >>if <(><:E:><)> <:S:> else <:S:>,<<
- [if] >>if <(><:E:><)> <:S:>,<<
- [while] >>while <(><:E:><)> <:S:>,<<
- [do-while] >>do <:S:> while <(><:E:><)>;,<<
- [for] >>for <(><:F:>; <:F:>; <:F:><)> <:S:>,<<
- [switch] >>switch <(><:E:><)> <:S:>,<<
- [case] >>case <:E:>: <:S:>,<<
- [default] >>default: <:S:>,<<
- [break] >>break;,<<
- [continue] >>continue;,<<
- [return] >>return <:F:>;,<<
- [goto] >>goto <:I:>;,<<
- [label] >><:I:>: <:S:>,<<
- [expression] >><:F:>;,<<
- [composite] >>{(ITR,<:S:>)}<<
- >>)) S
-
- ((and,<:E:>,<1>)) 1
- ((and,<:S:>,<2>)) 2
- ((and,<:S:>,<3>)) 3
- ((and,<:F:>,<4>)) 4
- ((and,<:F:>,<5>)) 5
- ((and,<:F:>,<6>)) 6
-
- )()(0 1 2 3 4 5 6)(
-
- [prnt WS] ((PWS)<>,);
- [if-then] (<0>@if (and,<(><:E:><)> <:S:> else <:S:>,<<
- >><(><:1:><)> <:2:> else <:3:>),<<
- >>(x,<1>)<<
- >>/jnz beta<0><<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/jmp gama<0><<
- >>/beta<0>:<<
- >>(w,(#+,<0>+1)@<3>)<<
- >>/gama<0>:<<
- >>);
- [if] (<0>@if <(><:1:><)> <:2:>,<<
- >>(x,<1>)<<
- >>/jnz beta<0><<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/beta<0>:<<
- >>);
- [while] (<0>@while <(><:1:><)> <:2:>,<<
- >>/alfa<0>:<<
- >>(x,<1>)<<
- >>/jz break<0><<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/contin<0>:<<<
- >>/jmp alfa<0><<
- >>/break<0>:<<
- >>);
- [do-while] (<0>@do <:2:> while <(><:1:><)>;,<<
- >>/alfa<0>:<<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/contin<0>:<<
- >>(x,<1>)<<
- >>/jnz alfa<0><<
- >>/break<0>:<<
- >>);
- [for] (<0>@for <(><:4:>; <:5:>; <:6:><)> <:2:>,<<
- >>(x,<4>)<<
- >>/alfa<0>:<<
- >>(y,<5>)<<
- >>/jz break<0><<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/contin<0>:<<<
- >>(x,<6>)<<
- >>/jmp alfa<0><<
- >>/break<0>:<<
- >>);
- [switch] (<0>@switch <(><:1:><)> <:2:>,<<
- >>(x,<1>)<<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/break<0>:<<
- >>);
- [case] (<0>@case <:1:>: <:2:>,<<
- >>(x,<1>)<<
- >>/compare alfa<0><<
- >>(w,(#+,<0>+1)@<2>)<<
- >>/alfa<0>:<<
- >>);
- [default] (<0>@default: <:2:>,<<
- >>(w,(#+,<0>+1)@<2>)<<
- >>);
- [break] (<0>@break;,<<
- >>/gobreak <0><<
- >>);
- [continue] (<0>@continue;,<<
- >>/gocontin <0><<
- >>);
- [return] (<0>@return <:1:>;,<<
- >>(x,<1>)<<
- >>/return<<
- >>);
- [return] (<0>@return;,<<
- >>/return<<
- >>);
- [goto] (<0>@goto (and,<:I:>,<1>);,<<
- >>/goto <1><<
- >>);
- [label] (<0>@(and,<:I:>:,<1>:) <:2:>,<<
- >>/<1>: (w,0@<2>)<<
- >>);
- [expression] (<0>@(and,<:E:>;,<1>;<>),(x,<1>));
- [compound] (<0>@{<:2:><1>}<>,(w,<0>@<2>)(w,<0>@{<1>}));
- [compound] (<0>@{},);
- (,other);
- )) w
-
- [token compilation of expressions]
- (()()(0 1 2)(
- (<0>,/compiled <0>);
- )) x
-
- [1 for null program]
- (()()(0)(
- (<>,/ db 1);
- (<0>,(x,<0>));
- )) y
-
- [main program including syntactic elements]
- ( (
- [alfanum] ((and,<[1]>,(IVL, ,~,))) a
- [letter] ((and,<[1]>,(or,(IVL,A,Z,),(IVL,a,z,),_))) b
- [odigit] ((and,<[1]>,(IVL,0,7,))) c
- [ddigit] ((and,<[1]>,(IVL,0,9,))) d
- [hdigit] ((and,<[1]>,(or,(IVL,0,9,),(IVL,A,F,),(IVL,a,f,)))) e
- [cconst] ((or,\<:a:>,<'><:a:><'>)) j
- [iconst] ((or,0(or,X,x)(ITR,<:e:>),0(ITR,<:c:>),<:d:>(ITR,<:d:>))) k
- [fconst] ((ITR,<:d:>).(ITR,<:d:>)(or,(or,E,e)(or,+,-,)(ITR,<:d:>),)) l
- [sconst] (<">(ITR,<:a:>)<">) m
- [constant] ((or,<:l:>,<:k:>,<:j:>,<:m:>)) o
- [identifier](<:b:>(ITR,(or,<:b:>,<:d:>))) I
- [aoperator] ((or,=,+=,-=,*=,/=,%=,(QUO/>>=/),(QUO/<<=/),&=,^=,|=)) p
- [boperator] ((or,*,/,%,+,-,(QUO/>>/),(QUO/<</),(QUO/<=/),<<
- >>(QUO/>=/),(<),(>),==,!=,&&,^,||,&,|)) q
- [uoperator] ((or,*,&,-,!,~,sizeof,<(>typename<)>)) r
- [lvalue] ((or,<<
- >>(and,<:P:>,<-->[<:E:>]<>),<<
- >>(and,<:P:>,<-->-(>)<:I:><>),<<
- >>(and,<:P:>,<-->.<:I:><>),<<
- >><:I:>,<<
- >>*<:E:>,<<
- >><(><:L:><)>)) L
- [pexten] ((or,[<:E:>],<(>(ITR,<:E:>)<)>,-(>)<:I:>,.<:I:>)) N
- [primary] ((or,<:I:>,<:o:>,<(><:E:><)>)(ITR,<:N:>)) P
- [eroot] ((or,<<
- >><:r:><:A:>,<<
- >>++<:L:>,<<
- >>--<:L:>,<<
- >><:L:>++,<<
- >><:L:>--,<<
- >><:P:>)) A
- [bexpr] (<:A:>(or,<:q:><:B:>,)) B
- [cexpr] (<:B:>(or,?<:K:>:<:K:>,)) K
- [aexpr] ((or,<:L:><:p:><:D:>,<:K:>)) D
- [expression](<:D:>(or,<,><:E:>,)) E
- ((or,<:E:>,)) F
- ) ()(0)(
- (;,done);
- (<0>,(%C,(w,1@<0>))(%R)):
- ))
-
- [end]
-