diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 4ce173e..8e5dda8 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -1420,6 +1420,62 @@ preferred to the underlying representation -- RDJ 9/12/83 @ +\defun{compSymbol}{compSymbol} +\calls{compSymbol}{getmode} +\calls{compSymbol}{get} +\calls{compSymbol}{NRTgetLocalIndex} +\calls{compSymbol}{member} +\calls{compSymbol}{isFunction} +\calls{compSymbol}{errorRef} +\calls{compSymbol}{stackMessage} +\usesdollar{compSymbol}{Symbol} +\usesdollar{compSymbol}{Expression} +\usesdollar{compSymbol}{FormalMapVariableList} +\usesdollar{compSymbol}{compForModeIfTrue} +\usesdollar{compSymbol}{formalArgList} +\usesdollar{compSymbol}{NoValueMode} +\usesdollar{compSymbol}{functorLocalParameters} +\usesdollar{compSymbol}{Boolean} +\usesdollar{compSymbol}{NoValue} +<>= +(defun |compSymbol| (s m e) + (let (v mprime) + (declare (special |$Symbol| |$Expression| |$FormalMapVariableList| + |$compForModeIfTrue| |$formalArgList| |$NoValueMode| + |$functorLocalParameters| |$Boolean| |$NoValue|)) + (cond + ((eq s '|$NoValue|) (list '|$NoValue| |$NoValueMode| e )) + ((|isFluid| s) + (setq mode (|getmode| s e)) + (when mode (list s (|getmode| s e) e))) + ((eq s '|true|) (list '(quote t) |$Boolean| e )) + ((eq s '|false|) (list nil |$Boolean| e )) + ((or (equal s m) (|get| s '|isLiteral| e)) (list (list 'quote s) s e)) + ((setq v (|get| s '|value| e)) + (cond + ((member s |$functorLocalParameters|) + ; s will be replaced by an ELT form in beforeCompile + (|NRTgetLocalIndex| s) + (list s (cadr v) e)) + (t + ; s has been SETQd + (list s (cadr v) e)))) + ((setq mprime (|getmode| s e)) + (cond + ((and (null (|member| s |$formalArgList|)) + (null (member s |$FormalMapVariableList|)) + (null (|isFunction| s e)) + (null (eq |$compForModeIfTrue| t))) + (|errorRef| s))) + (list s mprime e )) + ((member s |$FormalMapVariableList|) + (|stackMessage| (list '|no mode found for| s ))) + ((or (equal m |$Expression|) (equal m |$Symbol|)) + (list (list 'quote s) m e )) + ((null (|isFunction| s e)) (|errorRef| s))))) + +@ + \defun{compExpression}{compExpression} \calls{compExpression}{getl} \calls{compExpression}{compForm} @@ -2098,6 +2154,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index 52e0bb5..e0e0360 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20100904 tpd src/axiom-website/patches.html 20100904.04.tpd.patch +20100904 tpd src/interp/compiler.lisp treeshake compiler +20100904 tpd books/bookvol9 treeshake compiler 20100904 tpd src/axiom-website/patches.html 20100904.03.tpd.patch 20100904 tpd books/bookvol5 mark pure common lisp routines 20100904 tpd src/axiom-website/patches.html 20100904.02.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 4493797..f411a92 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3107,5 +3107,7 @@ src/interp/*.pamphlet remove memq
books/bookvolbib add Steele [Ste90]
20100904.03.tpd.patch books/bookvol5 mark pure common lisp routines
+20100904.04.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/compiler.lisp.pamphlet b/src/interp/compiler.lisp.pamphlet index cea61ef..bcce837 100644 --- a/src/interp/compiler.lisp.pamphlet +++ b/src/interp/compiler.lisp.pamphlet @@ -283,68 +283,6 @@ ('T NIL))) @ -\subsection{compSymbol} -<<*>>= -;compSymbol(s,m,e) == -; s="$NoValue" => ["$NoValue",$NoValueMode,e] -; isFluid s => [s,getmode(s,e) or return nil,e] -; s="true" => ['(QUOTE T),$Boolean,e] -; s="false" => [false,$Boolean,e] -; s=m or get(s,"isLiteral",e) => [["QUOTE",s],s,e] -; v:= get(s,"value",e) => -;--+ -; MEMQ(s,$functorLocalParameters) => -; NRTgetLocalIndex s -; [s,v.mode,e] --s will be replaced by an ELT form in beforeCompile -; [s,v.mode,e] --s has been SETQd -; m':= getmode(s,e) => -; if not MEMBER(s,$formalArgList) and not MEMQ(s,$FormalMapVariableList) and -; not isFunction(s,e) and null ($compForModeIfTrue=true) then errorRef s -; [s,m',e] --s is a declared argument -; MEMQ(s,$FormalMapVariableList) => stackMessage ["no mode found for",s] -; m = $Expression or m = $Symbol => [['QUOTE,s],m,e] -; not isFunction(s,e) => errorRef s - -(DEFUN |compSymbol| (|s| |m| |e|) - (PROG (|v| |m'|) - (declare (special |$Symbol| |$Expression| |$FormalMapVariableList| - |$compForModeIfTrue| |$formalArgList| |$NoValueMode| - |$functorLocalParameters| |$Boolean| |$NoValue|)) - (RETURN - (COND - ((BOOT-EQUAL |s| '|$NoValue|) - (CONS '|$NoValue| (CONS |$NoValueMode| (CONS |e| NIL)))) - ((|isFluid| |s|) - (CONS |s| - (CONS (OR (|getmode| |s| |e|) (RETURN NIL)) - (CONS |e| NIL)))) - ((BOOT-EQUAL |s| '|true|) - (CONS ''T (CONS |$Boolean| (CONS |e| NIL)))) - ((BOOT-EQUAL |s| '|false|) - (CONS NIL (CONS |$Boolean| (CONS |e| NIL)))) - ((OR (BOOT-EQUAL |s| |m|) (|get| |s| '|isLiteral| |e|)) - (CONS (CONS 'QUOTE (CONS |s| NIL)) (CONS |s| (CONS |e| NIL)))) - ((SPADLET |v| (|get| |s| '|value| |e|)) - (COND - ((member |s| |$functorLocalParameters|) - (|NRTgetLocalIndex| |s|) - (CONS |s| (CONS (CADR |v|) (CONS |e| NIL)))) - ('T (CONS |s| (CONS (CADR |v|) (CONS |e| NIL)))))) - ((SPADLET |m'| (|getmode| |s| |e|)) - (COND - ((AND (NULL (|member| |s| |$formalArgList|)) - (NULL (member |s| |$FormalMapVariableList|)) - (NULL (|isFunction| |s| |e|)) - (NULL (BOOT-EQUAL |$compForModeIfTrue| 'T))) - (|errorRef| |s|))) - (CONS |s| (CONS |m'| (CONS |e| NIL)))) - ((member |s| |$FormalMapVariableList|) - (|stackMessage| (CONS '|no mode found for| (CONS |s| NIL)))) - ((OR (BOOT-EQUAL |m| |$Expression|) (BOOT-EQUAL |m| |$Symbol|)) - (CONS (CONS 'QUOTE (CONS |s| NIL)) (CONS |m| (CONS |e| NIL)))) - ((NULL (|isFunction| |s| |e|)) (|errorRef| |s|)))))) - -@ \subsection{convertOrCroak} <<*>>= ;convertOrCroak(T,m) ==