diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 3894d0b..87413ce 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -1070,7 +1070,7 @@ For instance, for the file {\tt EQ.spad}, we get: \calls{preparse1}{escaped} \calls{preparse1}{instring} \calls{preparse1}{indent-pos} -\calls{preparse1}{getfullstr} +\calls{preparse1}{make-full-cvec} \calls{preparse1}{maxindex} \calls{preparse1}{strposl} \calls{preparse1}{is-console} @@ -1143,7 +1143,7 @@ STRLOOP ;; handle things that need ignoring, quoting, or grouping (setq ncomblock (cons n (cons a (ifcdr ncomblock)))) (setq a "")) (t - (push (strconc (getfullstr n " ") (substring a n ())) $linelist) + (push (strconc (make-full-cvec n " ") (substring a n ())) $linelist) (setq $index (1- $index)) (setq a (subseq a 0 n)))) (go NOCOMS)) @@ -1585,7 +1585,7 @@ of the symbol being parsed. The original list read: $<= parseDollarLessEqual $> parseDollarGreaterThan $>= parseDollarGreaterEqual - ($^= parseDollarNotEqual + $^= parseDollarNotEqual eqv parseEquivalence ;;xor parseExclusiveOr exit parseExit @@ -1801,7 +1801,7 @@ of the symbol being parsed. The original list read: @ -\defplist{dollarlessequal}{parseDollarLessEqual} +%\defplist{dollarlessequal}{parseDollarLessEqual} <>= (eval-when (eval load) (setf (get '|$<=| '|parseTran|) '|parseDollarLessEqual|)) @@ -1854,7 +1854,7 @@ of the symbol being parsed. The original list read: @ -\defplist{>=}{parseExit} +\defplist{$>=$}{parseExit} <>= (eval-when (eval load) (setf (get '|exit| '|parseTran|) '|parseExit|)) @@ -1880,7 +1880,7 @@ of the symbol being parsed. The original list read: @ -\defplist{>=}{parseGreaterEqual} +\defplist{$>=$}{parseGreaterEqual} <>= (eval-when (eval load) (setf (get '|>=| '|parseTran|) '|parseGreaterEqual|)) @@ -1897,7 +1897,7 @@ of the symbol being parsed. The original list read: @ -\defplist{>}{parseGreaterThan} +\defplist{$>$}{parseGreaterThan} <>= (eval-when (eval load) (setf (get '|>| '|parseTran|) '|parseGreaterThan|)) @@ -2284,7 +2284,7 @@ of the symbol being parsed. The original list read: @ -\defplist{<=}{parseLessEqual} +\defplist{$<=$}{parseLessEqual} <>= (eval-when (eval load) (setf (get '|<=| '|parseTran|) '|parseLessEqual|)) @@ -3736,7 +3736,7 @@ An angry JHD - August 15th., 1984 @ -\defplist{+->}{compLambda} +\defplist{$+->$}{compLambda} <>= (eval-when (eval load) (setf (get '|+->| 'special) '|compLambda|)) @@ -5260,7 +5260,7 @@ of the symbol being parsed. The original list read: @ -\defplist{=>}{postExit} +\defplist{$=>$}{postExit} <>= (eval-when (eval load) (setf (get '|=>| '|postTran|) '|postExit|)) @@ -5364,7 +5364,7 @@ of the symbol being parsed. The original list read: @ -\defplist{->}{postMapping} +\defplist{$->$}{postMapping} <>= (eval-when (eval load) (setf (get '|->| '|postTran|) '|postMapping|)) @@ -5385,7 +5385,7 @@ of the symbol being parsed. The original list read: @ -\defplist{==>}{postMDef} +\defplist{$==>$}{postMDef} <>= (eval-when (eval load) (setf (get '|==>| '|postTran|) '|postMDef|)) @@ -7821,7 +7821,7 @@ IteratorTail: ('repeat' ! / Iterator*) ; (must (|PARSE-Expr| 999)) (push-reduction '|PARSE-Primary1| (list 'quote (pop-stack-1))))))) - (|PARSE-Sequence|) (|PARSE-Enclosure|))) + (|PARSE-Sequence|) (|PARSE-Enclosure|)))) @ @@ -9011,6 +9011,52 @@ loop @ +\chapter{Utility Functions} + +\defun{fincomblock}{fincomblock} +\begin{itemize} +\item NUM is the line number of the current line +\item OLDNUMS is the list of line numbers of previous lines +\item OLDLOCS is the list of previous indentation locations +\item NCBLOCK is the current comment block +\end{itemize} +\calls{fincomblock}{preparse-echo} +\usesdollar{fincomblock}{comblocklist} +\usesdollar{fincomblock}{EchoLineStack} +<>= +(defun fincomblock (num oldnums oldlocs ncblock linelist) + (declare (special $EchoLineStack $comblocklist)) + (push + (cond + ((eql (car ncblock) 0) (cons (1- num) (reverse (cdr ncblock)))) + ;; comment for constructor itself paired with 1st line -1 + (t + (when $EchoLineStack + (setq num (pop $EchoLineStack)) + (preparse-echo linelist) + (setq $EchoLineStack (list num))) + (cons ;; scan backwards for line to left of current + (do ((onums oldnums (cdr onums)) + (olocs oldlocs (cdr olocs)) + (sloc (car ncblock))) + ((null onums) nil) + (when (and (numberp (car olocs)) (<= (car olocs) sloc)) + (return (car onums)))) + (reverse (cdr ncblock))))) + $comblocklist)) + +@ + +\defun{parseprint}{parseprint} +<>= +(defun parseprint (l) + (when l + (format t "~&~% *** PREPARSE ***~%~%") + (dolist (x l) (format t "~5d. ~a~%" (car x) (cdr x))) + (format t "~%"))) + +@ + \chapter{The Compiler} \section{Compiling EQ.spad} @@ -11835,6 +11881,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> <> <> @@ -11980,6 +12027,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index 6ff19c1..cf63928 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20101207 tpd src/axiom-website/patches.html 20101207.01.tpd.patch +20101207 tpd src/interp/vmlisp.lisp treeshake compiler +20101207 tpd src/interp/parsing.lisp treeshake compiler +20101207 tpd src/interp/i-output.lisp treeshake compiler +20101207 tpd books/bookvol9 treeshake compiler 20101206 tpd src/axiom-website/patches.html 20101206.04.tpd.patch 20101206 tpd src/interp/postprop.lisp merged with bookvol9, removed. 20101206 tpd src/interp/compiler.lisp treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index c017e33..b204c20 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3303,5 +3303,7 @@ books/bookvol12 add discussion of GTFL
books/bookvol9 treeshake compiler
20101206.04.tpd.patch books/bookvol9 merge and remove postprop.lisp
+20101207.01.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/i-output.lisp.pamphlet b/src/interp/i-output.lisp.pamphlet index 9cadaa1..e3f6db8 100644 --- a/src/interp/i-output.lisp.pamphlet +++ b/src/interp/i-output.lisp.pamphlet @@ -226,7 +226,7 @@ these functions return an updated ``layout so far'' in general (|appChar| |string| |x| |y| (NCONC |d| (CONS (CONS |y| - (GETFULLSTR + (make-full-cvec (PLUS (PLUS 10 $LINELENGTH) $MARGIN) '| |)) diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index af0fd5d..57b274a 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -1546,37 +1546,6 @@ preparse (do ((lines (PREPARSE in-stream) (PREPARSE in-stream))) ((null lines))))) T) -;; NUM is the line number of the current line -;; OLDNUMS is the list of line numbers of previous lines -;; OLDLOCS is the list of previous indentation locations -;; NCBLOCK is the current comment block -(DEFUN FINCOMBLOCK (NUM OLDNUMS OLDLOCS NCBLOCK linelist) - (PUSH - (COND ((EQL (CAR NCBLOCK) 0) (CONS (1- NUM) (REVERSE (CDR NCBLOCK)))) - ;; comment for constructor itself paired with 1st line -1 - ('T - (COND ($EchoLineStack - (setq NUM (POP $EchoLineStack)) - (PREPARSE-ECHO linelist) - (SETQ $EchoLineStack (LIST NUM)))) - (cons - ;; scan backwards for line to left of current - (DO ((onums oldnums (cdr onums)) - (olocs oldlocs (cdr olocs)) - (sloc (car ncblock))) - ((null onums) nil) - (if (and (numberp (car olocs)) - (<= (car olocs) sloc)) - (return (car onums)))) - (REVERSE (CDR NCBLOCK))))) - $COMBLOCKLIST)) - -(defun PARSEPRINT (L) - (if L - (progn (format t "~&~% *** PREPARSE ***~%~%") - (dolist (X L) (format t "~5d. ~a~%" (car x) (cdr x))) - (format t "~%")))) - (DEFUN SKIP-IFBLOCK (X) (PROG (LINE IND) (DCQ (IND . LINE) (preparseReadLine1 X)) diff --git a/src/interp/vmlisp.lisp.pamphlet b/src/interp/vmlisp.lisp.pamphlet index 8a35c10..e019c30 100644 --- a/src/interp/vmlisp.lisp.pamphlet +++ b/src/interp/vmlisp.lisp.pamphlet @@ -862,8 +862,6 @@ can be restored. (defun make-full-cvec (sint &optional (char #\space)) (make-string sint :initial-element (character char))) -(define-function 'getfullstr #'make-full-cvec) - ; 17.2 Accessing (defun QESET (cvec ind charnum)