diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 56f5ff8..18098f8 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -1453,6 +1453,48 @@ Symbolics read-line returns embedded newlines in a c-m-Y.") (|aplTran| u))) @ + +\begin{postTran}{postTran} +\calls{postTran}{postAtom} +\calls{postTran}{postTran} +\calls{postTran}{pairp} +\calls{postTran}{qcar} +\calls{postTran}{qcdr} +\calls{postTran}{unTuple} +\calls{postTran}{postTranList} +\calls{postTran}{postForm} +\calls{postTran}{postOp} +\calls{postTran}{postScriptsForm} +<>= +(defun |postTran| (x) + (let (op f tmp1 a tmp2 tmp3 b y) + (if (atom x) + (|postAtom| x) + (progn + (setq op (car x)) + (cond + ((and (atom op) (setq f (getl op '|postTran|))) + (funcall f x)) + ((and (pairp op) (eq (qcar op) '|elt|) + (progn + (setq tmp1 (qcdr op)) + (and (pairp tmp1) + (progn + (setq a (qcar tmp1)) + (setq tmp2 (qcdr tmp1)) + (and (pairp tmp2) + (eq (qcdr tmp2) nil) + (progn (setq b (qcar tmp2)) t)))))) + (cons (|postTran| op) (cdr (|postTran| (cons b (cdr x)))))) + ((and (pairp op) (eq (qcar op) '|Scripts|)) + (|postScriptsForm| op + (dolist (y (rest x) tmp3) + (setq tmp3 (append tmp3 (|unTuple| (|postTran| y))))))) + ((nequal op (setq y (|postOp| op))) + (cons y (|postTranList| (cdr x)))) + (t (|postForm| x))))))) + +@ \chapter{The Compiler} \section{Compiling EQ.spad} @@ -4570,6 +4612,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> <> <> <> diff --git a/changelog b/changelog index 51ed36d..9db7f4d 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20101003 tpd src/axiom-website/patches.html 20101003.03.tpd.patch +20101003 tpd src/interp/parsing.lisp treeshake compiler +20101003 tpd books/bookvol9 treeshake compiler 20101003 tpd src/axiom-website/patches.html 20101003.02.tpd.patch 20101003 tpd src/interp/parsing.lisp treeshake compiler 20101003 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 160943d..90cf08f 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3182,5 +3182,7 @@ books/bookvol9 treeshake compiler
books/bookvol9 treeshake compiler
20101003.02.tpd.patch books/bookvol9 treeshake compiler
+20101003.03.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index f841549..9190aee 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -4050,22 +4050,7 @@ parse ;;; *** |displayPreCompilationErrors| REDEFINED (DEFUN |displayPreCompilationErrors| NIL (PROG (|n| |errors| |heading|) (RETURN (SEQ (PROGN (SPADLET |n| (|#| (SPADLET |$postStack| (REMDUP (NREVERSE |$postStack|))))) (COND ((EQL |n| 0) NIL) ((QUOTE T) (SPADLET |errors| (COND ((> |n| 1) "errors") ((QUOTE T) "error"))) (COND (|$InteractiveMode| (|sayBrightly| (CONS " Semantic " (CONS |errors| (CONS " detected: " NIL))))) ((QUOTE T) (SPADLET |heading| (COND ((NEQUAL |$topOp| (QUOTE |$topOp|)) (CONS " " (CONS |$topOp| (CONS " has" NIL)))) ((QUOTE T) (CONS " You have" NIL)))) (|sayBrightly| (APPEND |heading| (CONS (QUOTE |%b|) (CONS |n| (CONS (QUOTE |%d|) (CONS "precompilation " (CONS |errors| (CONS ":" NIL)))))))))) (COND ((> |n| 1) (DO ((#0=#:G166154 |$postStack| (CDR #0#)) (|x| NIL) (|i| 1 (QSADD1 |i|))) ((OR (ATOM #0#) (PROGN (SETQ |x| (CAR #0#)) NIL)) NIL) (SEQ (EXIT (|sayMath| (CONS " " (CONS |i| (CONS ") " |x|)))))))) ((QUOTE T) (|sayMath| (CONS " " (CAR |$postStack|))))) (TERPRI)))))))) -;postTran x == -; atom x => -; postAtom x -; op := first x -; atom op and (f:= GET(op,'postTran)) => FUNCALL(f,x) -; op is ['elt,a,b] => -; u:= postTran [b,:rest x] -; [postTran op,:rest u] -; op is ['Scripts,:.] => -; postScriptsForm(op,"append"/[unTuple postTran y for y in rest x]) -; op^=(y:= postOp op) => [y,:postTranList rest x] -; postForm x - -;;; *** |postTran| REDEFINED - -(DEFUN |postTran| (|x|) (PROG (|op| |f| |ISTMP#1| |a| |ISTMP#2| |b| |u| |y|) (RETURN (SEQ (COND ((ATOM |x|) (|postAtom| |x|)) ((QUOTE T) (SPADLET |op| (CAR |x|)) (COND ((AND (ATOM |op|) (SPADLET |f| (GETL |op| (QUOTE |postTran|)))) (FUNCALL |f| |x|)) ((AND (PAIRP |op|) (EQ (QCAR |op|) (QUOTE |elt|)) (PROGN (SPADLET |ISTMP#1| (QCDR |op|)) (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) (PROGN (SPADLET |b| (QCAR |ISTMP#2|)) (QUOTE T))))))) (SPADLET |u| (|postTran| (CONS |b| (CDR |x|)))) (CONS (|postTran| |op|) (CDR |u|))) ((AND (PAIRP |op|) (EQ (QCAR |op|) (QUOTE |Scripts|))) (|postScriptsForm| |op| (PROG (#0=#:G166185) (SPADLET #0# NIL) (RETURN (DO ((#1=#:G166190 (CDR |x|) (CDR #1#)) (|y| NIL)) ((OR (ATOM #1#) (PROGN (SETQ |y| (CAR #1#)) NIL)) #0#) (SEQ (EXIT (SETQ #0# (APPEND #0# (|unTuple| (|postTran| |y|))))))))))) ((NEQUAL |op| (SPADLET |y| (|postOp| |op|))) (CONS |y| (|postTranList| (CDR |x|)))) ((QUOTE T) (|postForm| |x|))))))))) + ;postTranList x == [postTran y for y in x] ;;; *** |postTranList| REDEFINED