diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index a672cc8..7a09c23 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -1650,6 +1650,16 @@ preferred to the underlying representation -- RDJ 9/12/83 @ +\defun{convert}{convert} +\calls{convert}{resolve} +\calls{convert}{coerce} +<>= +(defun |convert| (td m) + (let (res) + (when (setq res (|resolve| (cadr td) m)) + (|coerce| td res)))) + +@ \defun{primitiveType}{primitiveType} \usesdollar{primitiveType}{DoubleFloat} \usesdollar{primitiveType}{NegativeInteger} @@ -1819,6 +1829,37 @@ preferred to the underlying representation -- RDJ 9/12/83 @ +\defun{compArgumentsAndTryAgain}{compArgumentsAndTryAgain} +\calls{compArgumentsAndTryAgain}{comp} +\calls{compArgumentsAndTryAgain}{compForm1} +\usesdollar{compArgumentsAndTryAgain}{EmptyMode} +<>= +(defun |compArgumentsAndTryAgain| (form m e) + (let (argl tmp1 a tmp2 tmp3 u) + (declare (special |$EmptyMode|)) + (setq argl (cdr form)) + (cond + ((and (pairp form) (eq (qcar form) '|elt|) + (progn + (setq tmp1 (qcdr form)) + (and (pairp tmp1) + (progn + (setq a (qcar tmp1)) + (setq tmp2 (qcdr tmp1)) + (and (pairp tmp2) (eq (qcdr tmp2) nil)))))) + (when (setq tmp3 (|comp| a |$EmptyMode| e)) + (setq e (caddr tmp3)) + (|compForm1| form m e))) + (t + (setq u + (dolist (x argl) + (setq tmp3 (or (|comp| x |$EmptyMode| e) (return '|failed|))) + (setq e (caddr tmp3)) + tmp3)) + (unless (eq u '|failed|) + (|compForm1| form m e)))))) + +@ \defun{compWithMappingMode}{compWithMappingMode} \calls{compWithMappingMode}{compWithMappingMode1} \usesdollar{compWithMappingMode}{formalArgList} @@ -2192,6 +2233,31 @@ preferred to the underlying representation -- RDJ 9/12/83 @ +\defun{extractCodeAndConstructTriple}{extractCodeAndConstructTriple} +<>= +(defun |extractCodeAndConstructTriple| (u m oldE) + (let (tmp1 a fn op env) + (cond + ((and (pairp u) (eq (qcar u) '|call|) + (progn + (setq tmp1 (qcdr u)) + (and (pairp tmp1) + (progn (setq fn (qcar tmp1)) t)))) + (cond + ((and (pairp fn) (eq (qcar fn) '|applyFun|) + (progn + (setq tmp1 (qcdr fn)) + (and (pairp tmp1) (eq (qcdr tmp1) nil) + (progn (setq a (qcar tmp1)) t)))) + (setq fn a))) + (list fn m oldE)) + (t + (setq op (car u)) + (setq env (car (reverse (cdr u)))) + (list (list 'cons (list '|function| op) env) m oldE))))) + +@ + \defun{hasFormalMapVariable}{hasFormalMapVariable} \calls{hasFormalMapVariable}{ScanOrPairVec} \usesdollar{hasFormalMapVariable}{formalMapVariables} @@ -2565,6 +2631,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> <> <> @@ -2594,6 +2661,9 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> + +<> <> diff --git a/changelog b/changelog index 52c3c8f..d5adba9 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20100918 tpd src/axiom-website/patches.html 20100918.01.tpd.patch +20100918 tpd src/interp/compiler.lisp treeshake compiler +20100918 tpd books/bookvol9 treeshake compiler 20100917 tpd src/axiom-website/patches.html 20100917.01.tpd.patch 20100917 tpd src/interp/compiler.lisp treeshake compiler 20100917 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 09161d3..3160186 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3125,5 +3125,7 @@ src/input/manuel.input add Manuel's integral to test suite
books/bookvol9 treeshake compiler
20100917.01.tpd.patch books/bookvol9 treeshake compiler
+20100918.01.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/compiler.lisp.pamphlet b/src/interp/compiler.lisp.pamphlet index 1b88986..b76a276 100644 --- a/src/interp/compiler.lisp.pamphlet +++ b/src/interp/compiler.lisp.pamphlet @@ -45,42 +45,6 @@ @ -\subsection{extractCodeAndConstructTriple} -<<*>>= -;extractCodeAndConstructTriple(u, m, oldE) == -; u is ["call",fn,:.] => -; if fn is ["applyFun",a] then fn := a -; [fn,m,oldE] -; [op,:.,env] := u -; [["CONS",["function",op],env],m,oldE] - -(DEFUN |extractCodeAndConstructTriple| (|u| |m| |oldE|) - (PROG (|ISTMP#1| |a| |fn| |op| |LETTMP#1| |env|) - (RETURN - (COND - ((AND (PAIRP |u|) (EQ (QCAR |u|) '|call|) - (PROGN - (SPADLET |ISTMP#1| (QCDR |u|)) - (AND (PAIRP |ISTMP#1|) - (PROGN (SPADLET |fn| (QCAR |ISTMP#1|)) 'T)))) - (COND - ((AND (PAIRP |fn|) (EQ (QCAR |fn|) '|applyFun|) - (PROGN - (SPADLET |ISTMP#1| (QCDR |fn|)) - (AND (PAIRP |ISTMP#1|) (EQ (QCDR |ISTMP#1|) NIL) - (PROGN (SPADLET |a| (QCAR |ISTMP#1|)) 'T)))) - (SPADLET |fn| |a|))) - (CONS |fn| (CONS |m| (CONS |oldE| NIL)))) - ('T (SPADLET |op| (CAR |u|)) - (SPADLET |LETTMP#1| (REVERSE (CDR |u|))) - (SPADLET |env| (CAR |LETTMP#1|)) - (CONS (CONS 'CONS - (CONS (CONS '|function| (CONS |op| NIL)) - (CONS |env| NIL))) - (CONS |m| (CONS |oldE| NIL)))))))) - -@ - \subsection{convertOrCroak} <<*>>= ;convertOrCroak(T,m) == @@ -105,16 +69,6 @@ (CONS |m| (CONS '|%l| NIL))))))))))))))) @ -\subsection{convert} -<<*>>= -;convert(T,m) == -; coerce(T,resolve(T.mode,m) or return nil) - -(DEFUN |convert| (T$ |m|) - (PROG () - (RETURN (|coerce| T$ (OR (|resolve| (CADR T$) |m|) (RETURN NIL)))))) - -@ \subsection{mkUnion} <<*>>= ;mkUnion(a,b) == @@ -198,61 +152,6 @@ (|hasType,fn| (|get| |x| '|condition| |e|))) @ -\subsection{compArgumentsAndTryAgain} -<<*>>= -;compArgumentsAndTryAgain(form is [.,:argl],m,e) == -; -- used in case: f(g(x)) where f is in domain introduced by -; -- comping g, e.g. for (ELT (ELT x a) b), environment can have no -; -- modemap with selector b -; form is ["elt",a,.] => -; ([.,.,e]:= comp(a,$EmptyMode,e) or return nil; compForm1(form,m,e)) -; u:= for x in argl repeat [.,.,e]:= comp(x,$EmptyMode,e) or return "failed" -; u="failed" => nil -; compForm1(form,m,e) - -(DEFUN |compArgumentsAndTryAgain| (|form| |m| |e|) - (PROG (|argl| |ISTMP#1| |a| |ISTMP#2| |LETTMP#1| |u|) - (declare (special |$EmptyMode|)) - (RETURN - (SEQ (PROGN - (SPADLET |argl| (CDR |form|)) - (COND - ((AND (PAIRP |form|) (EQ (QCAR |form|) '|elt|) - (PROGN - (SPADLET |ISTMP#1| (QCDR |form|)) - (AND (PAIRP |ISTMP#1|) - (PROGN - (SPADLET |a| (QCAR |ISTMP#1|)) - (SPADLET |ISTMP#2| (QCDR |ISTMP#1|)) - (AND (PAIRP |ISTMP#2|) - (EQ (QCDR |ISTMP#2|) NIL)))))) - (SPADLET |LETTMP#1| - (OR (|comp| |a| |$EmptyMode| |e|) - (RETURN NIL))) - (SPADLET |e| (CADDR |LETTMP#1|)) - (|compForm1| |form| |m| |e|)) - ('T - (SPADLET |u| - (DO ((G166982 |argl| (CDR G166982)) - (|x| NIL)) - ((OR (ATOM G166982) - (PROGN - (SETQ |x| (CAR G166982)) - NIL)) - NIL) - (SEQ (EXIT (PROGN - (SPADLET |LETTMP#1| - (OR - (|comp| |x| |$EmptyMode| |e|) - (RETURN '|failed|))) - (SPADLET |e| - (CADDR |LETTMP#1|)) - |LETTMP#1|))))) - (COND - ((BOOT-EQUAL |u| '|failed|) NIL) - ('T (|compForm1| |form| |m| |e|)))))))))) - -@ \subsection{outputComp} <<*>>= ;outputComp(x,e) ==