diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 75be099..d668ba8 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -2211,6 +2211,54 @@ nothing (see boot2Lisp) yet still allow function call (lisp2BootAndComp). @ +\defun{def-where}{def-where} +\calls{def-where}{def-whereclauselist} +\calls{def-where}{def-inner} +\calls{def-where}{sublis} +\calls{def-where}{mkprogn} +\calls{def-where}{deftran} +\usesdollar{def-where}{defstack} +\usesdollar{def-where}{opassoc} +<>= +(defun def-where (args) + (let ((x (car args)) (y (cdr args)) $defstack) + (declare (special $defstack $opassoc)) + (let ((u (def-whereclauselist y))) + (mapc #'(lambda (X) (def-inner (first x) nil (sublis $opassoc (second x)))) + $defstack) + (mkprogn (nconc u (list (deftran x))))))) + +@ + +\defun{def-whereclauselist}{def-whereclauselist} +\calls{def-whereclauselist}{def-whereclause} +\calls{def-whereclauselist}{deftran} +<>= +(defun def-whereclauselist (l) + (if (not (cdr l)) + (def-whereclause (deftran (first l))) + (reduce #'append (mapcar #'(lambda (u) (def-whereclause (deftran u))) l)))) + +@ + +\defun{def-whereclause}{def-whereclause} +\calls{def-whereclause}{eqcar} +\calls{def-whereclause}{def-whereclause} +\calls{def-whereclause}{whdef} +<>= +(defun def-whereclause (x) + (cond + ((or (eqcar x 'seq) (eqcar x 'progn)) + (reduce #'append (mapcar #'def-whereclause (cdr x)))) + ((eqcar x 'def) + (whdef (second x) (first (cddddr x))) nil) + ((and (eqcar x '|exit|) (eqcar (second x) 'def)) + (whdef (cadadr x) (first (cddddr (second x)) )) nil) + ((list x)))) + +@ + + \defun{addCARorCDR}{addCARorCDR} \calls{addCARorCDR}{eqcar} \calls{addCARorCDR}{qcdr} @@ -2242,6 +2290,47 @@ nothing (see boot2Lisp) yet still allow function call (lisp2BootAndComp). @ \subsection{IS} +\defun{def-is}{def-is} +\calls{def-is}{def-is2} +\usesdollar{def-is}{is-gensymlist} +\uses{def-is}{Initial-Gensym} +<>= +(defun def-is (x) + (let (($is-gensymlist Initial-Gensym)) + (declare (special is-gensymlist Initial-Gensym)) + (def-is2 (first X) (second x)))) + +@ + +\defun{def-is2}{def-is2} +\calls{def-is2}{eqcar} +\calls{def-is2}{moan} +\calls{def-is2}{def-is-eqlist} +\calls{def-is2}{def-is-remdup} +\calls{def-is2}{mkpf} +\calls{def-is2}{subst} +\calls{def-is2}{dcq} +\calls{def-is2}{listofatoms} +\calls{def-is2}{/tracelet-print} +\usesdollar{def-is2}{is-eqlist} +\usesdollar{def-is2}{is-spill-list} +<>= +(defun def-is2 (form struct) + (let ($is-eqlist $is-spill-list (form (deftran form))) + (when (eqcar struct '|@Tuple|) + (moan "you must use square brackets around right arg. to" '%b "is" '%d)) + (let* ((x (def-is-eqlist (def-is-remdup struct))) + (code (if (identp x) + (mkpf (subst form x $is-eqlist) 'and) + (mkpf `((dcq ,x ,form) . ,$is-eqlist) 'and)))) + (let ((code (mkpf `(,code . ,$is-spill-list) 'and))) + (if $traceletflag + (let ((l (remove-if #'gensymp (listofatoms x)))) + `(prog1 ,code ,@(mapcar #'(lambda (y) `(/tracelet-print ,y ,y)) L))) + code))))) + +@ + \defun{defIS}{defIS} \calls{defIS}{deftran} \calls{defIS}{defIS1} @@ -2361,6 +2450,7 @@ nothing (see boot2Lisp) yet still allow function call (lisp2BootAndComp). (def-is (list lhs rhs)))))) @ + \defun{defISReverse}{defISReverse} This reverses forms coming from APPENDs in patterns. It is pretty much just a translation of DEF-IS-REV @@ -2380,11 +2470,43 @@ It is pretty much just a translation of DEF-IS-REV @ -;unTuple x == -; x is ['Tuple,:y] => y -; LIST x +\defun{def-collect}{def-collect} +\calls{def-collect}{def-it} +\calls{def-collect}{deftran} +\calls{def-collect}{hackforis} +<>= +(defun def-collect (l) + (def-it 'collect (mapcar #'deftran (hackforis l)))) + +@ + +\defun{def-repeat}{def-repeat} +\calls{def-repeat}{def-it} +\calls{def-repeat}{deftran} +\calls{def-repeat}{hackforis} +<>= +(defun def-repeat (l) + (def-it 'repeat (mapcar #'deftran (hackforis l)))) + +@ -;;; *** |unTuple| REDEFINED +\defun{hackforis}{hackforis} +\calls{hackforis}{hackforis1} +<>= +(defun hackforis (l) (mapcar #'hackforis1 L)) + +@ + +\defun{hackforis1}{hackforis1} +\calls{hackforis1}{kar} +\calls{hackforis1}{eqcar} +<>= +(defun hackforis1 (x) + (if (and (member (kar x) '(in on)) (eqcar (second x) 'is)) + (cons (first x) (cons (cons 'spadlet (cdadr x)) (cddr x))) + x)) + +@ \defun{unTuple}{unTuple} <>= @@ -2395,6 +2517,14 @@ It is pretty much just a translation of DEF-IS-REV @ +\defun{errhuh}{errhuh} +\calls{errhuh}{systemError} +<>= +(defun errhuh () + (|systemError| "problem with BOOT to LISP translation")) + +@ + \chapter{The Compiler} \section{Compiling EQ.spad} @@ -5504,7 +5634,10 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> +<> +<> <> <> <> @@ -5516,8 +5649,13 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> +<> +<> +<> +<> <> <> @@ -5525,6 +5663,8 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> +<> <> <> diff --git a/changelog b/changelog index 7aeb153..a3b951b 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20101014 tpd src/axiom-website/patches.html 20101014.01.tpd.patch +20101014 tpd src/interp/parsing.lisp treeshake compiler +20101014 tpd books/bookvol9 treeshake compiler 20101013 tpd src/axiom-website/patches.html 20101013.02.tpd.patch 20101013 tpd src/interp/g-boot.lisp treeshake compiler 20101013 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 3901bed..9d048e8 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3210,5 +3210,7 @@ books/bookvol9 treeshake compiler
books/bookvol9 treeshake compiler
20101013.02.tpd.patch books/bookvol9 treeshake compiler
+20101014.01.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index d0c7126..a212816 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -1394,17 +1394,6 @@ foo defined inside of fum gets renamed as fum,foo.") (let ((expr (first x)) (type (second x))) (if (EQUAL TYPE '(|Triple|)) EXPR (ERRHUH)))) -(defun DEF-COLLECT (L) (DEF-IT 'COLLECT (MAPCAR #'DEFTRAN (HACKFORIS L)))) - -(defun DEF-REPEAT (L) (DEF-IT 'REPEAT (mapcar #'DEFTRAN (HACKFORIS L)))) - -(defun HACKFORIS (L) (mapcar #'hackforis1 L)) - -(defun HACKFORIS1 (X) - (if (AND (MEMBER (KAR X) '(IN ON)) (EQCAR (SECOND X) 'IS)) - (CONS (FIRST X) (CONS (CONS 'SPADLET (CDADR X)) (CDDR X))) - X)) - (defun DEF-select (L) (cond ((IDENTP (FIRST L)) (DEF-select1 (FIRST L) (SECOND L))) ((LET* ((G (GENSYM)) @@ -1505,10 +1494,6 @@ foo defined inside of fum gets renamed as fum,foo.") (defparameter Initial-Gensym (list (gensym))) -(defun DEF-IS (X) - (let (($IS-GENSYMLIST Initial-Gensym)) - (DEF-IS2 (first X) (second x)))) - (defun IS-GENSYM () (if (NOT (CDR $IS-GENSYMLIST)) (RPLACD $IS-GENSYMLIST (LIST (GENSYM)))) (pop $IS-GENSYMLIST)) @@ -1516,21 +1501,6 @@ foo defined inside of fum gets renamed as fum,foo.") (defparameter $IS-EQLIST nil) (defparameter $IS-SPILL_LIST nil) -(defun DEF-IS2 (FORM STRUCT) - (let ($IS-EQLIST $IS-SPILL_LIST (FORM (DEFTRAN FORM))) - (if (EQCAR STRUCT '|@Tuple|) - (MOAN "you must use square brackets around right arg. to" '%b "is" '%d)) - (let* ((X (DEF-IS-EQLIST (DEF-IS-REMDUP STRUCT))) - (CODE (if (IDENTP X) - (MKPF (SUBST FORM X $IS-EQLIST) 'AND) - (MKPF `((DCQ ,X ,FORM) . ,$IS-EQLIST) 'AND)))) - (let ((CODE (MKPF `(,CODE . ,$IS-SPILL_LIST) 'AND))) - (if $TRACELETFLAG - (let ((L (remove-if #'gensymp (listofatoms x)))) - `(PROG1 ,CODE - ,@(mapcar #'(lambda (y) `(/tracelet-print ,y ,y)) L))) - CODE))))) - (defun DEF-STRING (X) ;; following patches needed to fix reader bug in Lucid Common Lisp (if (and (> (size x) 0) (or (char= (elt x 0) #\.) (char= (elt x 0) #\Page))) @@ -1626,28 +1596,6 @@ foo defined inside of fum gets renamed as fum,foo.") (defparameter $DEFSTACK nil) -(defun DEF-WHERE (args) - (let ((x (car args)) (y (cdr args)) $DEFSTACK) - (let ((u (DEF-WHERECLAUSELIST Y))) - (mapc #'(lambda (X) (DEF-INNER (FIRST X) NIL - (SUBLIS $OPASSOC (SECOND X)))) - $DEFSTACK) - (MKPROGN (NCONC U (LIST (DEFTRAN X))))))) - -(defun DEF-WHERECLAUSELIST (L) - (if (NOT (CDR L)) - (DEF-WHERECLAUSE (DEFTRAN (FIRST L))) - (REDUCE #'APPEND - (mapcar #'(lambda (u) (def-whereclause (deftran u))) L)))) - -(defun DEF-WHERECLAUSE (X) - (COND ((OR (EQCAR X 'SEQ) (EQCAR X 'PROGN)) - (reduce #'append (mapcar #'def-whereclause (cdr x)))) - ((EQCAR X 'DEF) (WHDEF (SECOND X) (FIRST (CDDDDR X))) NIL) - ((AND (EQCAR X '|exit|) (EQCAR (SECOND X) 'DEF)) - (WHDEF (CADADR X) (FIRST (CDDDDR (SECOND X)) )) NIL) - ((LIST X)))) - (defun WHDEF (X Y) "Returns no value -- side effect is to do a compilation or modify a global." (prog ((XP (if (ATOM X) (LIST X) X)) Op) @@ -1658,8 +1606,6 @@ foo defined inside of fum gets renamed as fum,foo.") (SETQ $DEFSTACK (CONS (LIST (CONS OP (CDR XP)) Y) $DEFSTACK)) NIL)) -(defun ERRHUH () (|systemError| "problem with BOOT to LISP translation")) - (mapcar #'(lambda (x) (MAKEPROP (first X) 'SEL\,FUNCTION (second X))) '((|aTree| 0) (|aMode| 1) (|aValue| 2) (|aModeSet| 3)