diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index a8ff6ae..9b361d3 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -34498,13 +34498,13 @@ searchCurrentEnv(x,currentEnv) == <>= (defun init-boot/spad-reader () (declare (special $spad_errors spaderrorstream *standard-output* - xtokenreader line-handler meta_error_handler file-closed + xtokenreader line-handler meta-error-handler file-closed boot-line-stack)) (setq $spad_errors (vector 0 0 0)) (setq spaderrorstream *standard-output*) (setq xtokenreader 'get-BOOT-token) (setq line-Handler 'next-BOOT-line) - (setq meta_error_handler 'spad_syntax_error) + (setq meta-error-handler 'spad-syntax-error) (setq file-closed nil) (next-lines-clear) (ioclear)) diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index c0fb585..e1779ab 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -4496,7 +4496,9 @@ This section is broken up into 3 levels: \item Token handling: Current Token, Next Token, Advance Token \item Character handling: Current Char, Next Char, Advance Char \item Line handling: Next Line, Print Next Line -\item Random Stuff +\item Error Handling +\item Floating Point Support +\item Dollar Translation \end{itemize} \subsection{String grabbing} String grabbing is the art of matching initial segments of the current @@ -4637,6 +4639,14 @@ If it is successful, advance inputstream past X. \subsection{Token Handling} +\defun{getToken}{getToken} +\calls{getToken}{eqcar} +<>= +(defun |getToken| (x) + (if (eqcar x '|elt|) (third x) x)) + +@ + \defun{unget-tokens}{unget-tokens} \calls{unget-tokens}{quote-if-string} \calls{unget-tokens}{line-current-segment} @@ -4803,6 +4813,102 @@ This makes the next token be the current token. @ +\subsection{Character handling} + +\defun{current-char}{current-char} +This returns the current character of the line, initially blank for an +unread line. +\calls{current-char}{line-past-end-p} +\calls{current-char}{line-current-char} +\uses{current-char}{current-line} +<>= +(defun current-char () + (if (line-past-end-p current-line) + #\return + (line-current-char current-line))) + +@ + +\defun{next-char}{next-char} +This returns the character after the current character, blank if at +end of line. The blank-at-end-of-line assumption is allowable because +we assume that end-of-line is a token separator, which blank is +equivalent to. +\calls{next-char}{line-at-end-p} +\calls{next-char}{line-next-char} +\uses{next-char}{current-line} +<>= +(defun next-char () + (if (line-at-end-p current-line) + #\return + (line-next-char current-line))) + +@ + +\defun{char-eq}{char-eq} +<>= +(defun char-eq (x y) + (char= (character x) (character y))) + +@ + +\defun{char-ne}{char-ne} +<>= +(defun char-ne (x y) + (char/= (character x) (character y))) + +@ + +\subsection{Error handling} +\defvar{meta-error-handler} +<>= +(defvar meta-error-handler 'meta-meta-error-handler) + +@ + +\defun{meta-syntax-error}{meta-syntax-error} +\calls{meta-syntax-error}{meta-error-handler} +\uses{meta-syntax-error}{meta-error-handler} +<>= +(defun meta-syntax-error (&optional (wanted nil) (parsing nil)) + (funcall meta-error-handler wanted parsing)) + +@ + +\subsection{Floating Point Support} + +\defun{floatexpid}{floatexpid} +\calls{floatexpid}{identp} +\calls{floatexpid}{pname} +\calls{floatexpid}{spadreduce} +\calls{floatexpid}{collect} +\calls{floatexpid}{step} +\calls{floatexpid}{maxindex} +\calls{floatexpid}{digitp} +<>= +(defun floatexpid (x &aux s) + (when (and (identp x) (char= (char-upcase (elt (setq s (pname x)) 0)) #\E) + (> (length s) 1) + (spadreduce and 0 (collect (step i 1 1 (maxindex s)) + (digitp (elt s i))))) + (read-from-string s t nil :start 1))) + +@ + +\subsection{Dollar Translation} + +\defun{dollarTran}{dollarTran} +\usesdollar{dollarTran}{InteractiveMode} +<>= +(defun |dollarTran| (dom rand) + (let ((eltWord (if |$InteractiveMode| '|$elt| '|elt|))) + (declare (special |$InteractiveMode|)) + (if (and (not (atom rand)) (cdr rand)) + (cons (list eltWord dom (car rand)) (cdr rand)) + (list eltWord dom rand)))) + +@ + \subsection{Applying metagrammatical elements of a production (e.g., Star).} \begin{itemize} \item {\bf must} means that if it is not present in the token stream, @@ -7959,6 +8065,8 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> +<> +<> <> <> <> @@ -7998,6 +8106,7 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> <> @@ -8037,16 +8146,19 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> <> <> +<> <> <> <> <> +<> <> <> @@ -8066,8 +8178,10 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> <> +<> <> <> <> diff --git a/changelog b/changelog index 13e3de7..a8ab199 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20101017 tpd src/axiom-website/patches.html 20101017.04.tpd.patch +20101017 tpd src/interp/parsing.lisp treeshake compiler +20101017 tpd books/bookvol9 treeshake compiler +20101017 tpd books/bookvol5 rename variables to remove underscores +20101017 tpd src/interp/vmlisp.lisp rename variables to remove underscores 20101017 tpd src/axiom-website/patches.html 20101017.03.tpd.patch 20101017 tpd src/interp/parsing.lisp treeshake compiler 20101017 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index d0dc13e..a1e6e9d 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3232,5 +3232,7 @@ books/bookvol9 merge and remove fnewmeta
books/bookvol9 treeshake compiler
20101017.03.tpd.patch books/bookvol9 treeshake compiler
+20101017.04.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index 0f8a64d..cacf4de 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -280,21 +280,6 @@ can be shoved back on the input stream (to the current line) with Unget-Tokens. @ \subsubsection{Character handling} <<*>>= -(defun Current-Char () - "Returns the current character of the line, initially blank for an - unread line." - (if (Line-Past-End-P Current-Line) - #\Return - (Line-Current-Char Current-Line))) - -(defun Next-Char () - "Returns the character after the current character, blank if at end of line. - The blank-at-end-of-line assumption is allowable because we assume that - end-of-line is a token separator, which blank is equivalent to." - (if (Line-At-End-P Current-Line) - #\Return - (Line-Next-Char Current-Line))) - (defun Advance-Char () "Advances IN-STREAM, invoking Next Line if necessary." (loop @@ -368,11 +353,6 @@ top (defparameter Meta_Errors_Occurred nil "Did any errors occur") -(defparameter Meta_Error_Handler 'meta-meta-error-handler) - -(defun meta-syntax-error (&optional (wanted nil) (parsing nil)) - (funcall Meta_Error_Handler wanted parsing)) - @ \subsection{Constructing parsing procedures} <<*>>= @@ -637,39 +617,11 @@ This state may be examined and reset with the procedures IOSTAT and IOCLEAR. nil) @ -\subsection{Meta file handling, auxiliary parsing actions and tokenizing} -<<*>>= -@ -\subsection{Boot file handling, auxiliary parsing actions and tokenizing} -<<*>>= -@ -\subsection{Boot parsing} -<<*>>= -@ <<*>>= ;; auxiliary functions needed by the parser -(defun char-eq (x y) (char= (character x) (character y))) - -(defun char-ne (x y) (char/= (character x) (character y))) - -(Defun FLOATEXPID (X &aux S) - (if (AND (IDENTP X) (char= (char-upcase (ELT (SETQ S (PNAME X)) 0)) #\E) - (> (LENGTH S) 1) - (SPADREDUCE AND 0 (COLLECT (STEP I 1 1 (MAXINDEX S)) - (DIGITP (ELT S I))))) - (READ-FROM-STRING S t nil :start 1) - NIL)) - -(defun |getToken| (x) (if (EQCAR x '|elt|) (third x) x)) - -(defun |dollarTran| (dom rand) - (let ((eltWord (if |$InteractiveMode| '|$elt| '|elt|))) - (if (and (not (atom rand)) (cdr rand)) - (cons (list eltWord dom (car rand)) (cdr rand)) - (list eltWord dom rand)))) @ bootlex <<*>>= @@ -996,7 +948,7 @@ or the chracters ?, !, ' or %" ; **** 5. BOOT Error Handling -(defun SPAD_SYNTAX_ERROR (&rest byebye) +(defun SPAD-SYNTAX-ERROR (&rest byebye) "Print syntax error indication, underline character, scrub line." (BUMPERRORCOUNT '|syntax|) (COND ((AND (EQ DEBUGMODE 'YES) (NOT(CONSOLEINPUTP IN-STREAM))) diff --git a/src/interp/vmlisp.lisp.pamphlet b/src/interp/vmlisp.lisp.pamphlet index a027bb1..b26c25e 100644 --- a/src/interp/vmlisp.lisp.pamphlet +++ b/src/interp/vmlisp.lisp.pamphlet @@ -5874,7 +5874,7 @@ now the function is defined but does nothing. (defun |process| (x) (COND ((NOT (EQ TOK 'END_UNIT)) (SETQ DEBUGMODE 'NO) - (SPAD_SYNTAX_ERROR) + (SPAD-SYNTAX-ERROR) (if |$InteractiveMode| (|spadThrow|)) (S-PROCESS x)))) @@ -5917,7 +5917,7 @@ special. XTOKENREADER STACK STACKX) (SETQ XTRANS '|boot-New| XTOKENREADER 'NewSYSTOK - SYNTAX_ERROR 'SPAD_SYNTAX_ERROR) + SYNTAX_ERROR 'SPAD-SYNTAX-ERROR) (FLAG |boot-NewKEY| 'KEY) (SETQ *PROMPT* 'Scratchpad-II) (PROMPT)