4-2-8
Fact { 0 = 1; sN = <Int 'N:='('"'sN)';' Prod ('I:=1,N') ('I') >; } Int { eX = <Eval () eX>; } Eval { (eE) sV ':='tX';'eY = <Eval (eE (sV <Eval (eE) tX>)) eY>; tE sN = <Subst tE sN>; tE ('"'eX) = eX; tE (eX) = <Eval tE eX>; tE eX '=' eY = <Equ (<Eval tE eX>) <Eval tE eY>>; tE eX '+' eY = <ADD (<Eval tE eX>) <Eval tE eY>>; tE eX '-' eY '-' eZ = <Eval tE (eX '-' eY) '-' eZ>; tE eX '-' eY = <SUB (<Eval tE eX>) <Eval tE eY>>; tE eX '*' eY = <MUL (<Eval tE eX>) <Eval tE eY>>; tE sF (eX) = <Func sF <Eval tE eX>>; tE If tC Then tT Else tF = <Eval tE <If <Eval tE tC> tT tF>>; tE Prod (sV':='eL','eH) (eX) = <Prod tE sV (<Eval tE eL>) (<Eval tE eH>) (eX)>; } Prod { tE sV (sL) (sL) (eX) = <Eval tE sV':='('"'sL)';'eX>; tE sV (sL) (sH) (eX) = <MUL (<Eval tE sV':='('"'sH)';'eX>) <Prod tE sV (sL) (<Sub (sH) 1>) (eX)>>; } ... |