diff --git a/books/bookvol9.pamphlet b/books/bookvol9.pamphlet index 6ec7952..1eda437 100644 --- a/books/bookvol9.pamphlet +++ b/books/bookvol9.pamphlet @@ -2911,6 +2911,117 @@ It is pretty much just a translation of DEF-IS-REV @ +\defun{PARSE-Expression}{PARSE-Expression} +\calls{PARSE-Expression}{PARSE-Expr} +\calls{PARSE-Expression}{PARSE-rightBindingPowerOf} +\calls{PARSE-Expression}{make-symbol-of} +\calls{PARSE-Expression}{push-reduction} +\calls{PARSE-Expression}{pop-stack-1} +\uses{PARSE-Expression}{ParseMode} +\uses{PARSE-Expression}{prior-token} +<>= +(defun |PARSE-Expression| () + (declare (special prior-token)) + (and (|PARSE-Expr| + (|PARSE-rightBindingPowerOf| (make-symbol-of prior-token) + |ParseMode|)) + (push-reduction '|PARSE-Expression| (pop-stack-1)))) + +@ + +\defun{PARSE-Import}{PARSE-Import} +\calls{PARSE-Import}{match-advance-string} +\calls{PARSE-Import}{must} +\calls{PARSE-Import}{PARSE-Expr} +\calls{PARSE-Import}{bang} +\calls{PARSE-Import}{optional} +\calls{PARSE-Import}{star} +\calls{PARSE-Import}{push-reduction} +\calls{PARSE-Import}{pop-stack-2} +\calls{PARSE-Import}{pop-stack-1} +<>= +(defun |PARSE-Import| () + (and (match-advance-string "import") (must (|PARSE-Expr| 1000)) + (bang fil_test + (optional + (star repeator + (and (match-advance-string ",") + (must (|PARSE-Expr| 1000)))))) + (push-reduction '|PARSE-Import| + (cons '|import| + (cons (pop-stack-2) (append (pop-stack-1) nil)))))) + +@ + +\defun{PARSE-Expr}{PARSE-Expr} +\calls{PARSE-Expr}{PARSE-NudPart} +\calls{PARSE-Expr}{PARSE-LedPart} +\calls{PARSE-Expr}{optional} +\calls{PARSE-Expr}{star} +\calls{PARSE-Expr}{push-reduction} +\calls{PARSE-Expr}{pop-stack-1} +<>= +(defun |PARSE-Expr| (rbp) + (declare (special rbp)) + (and (|PARSE-NudPart| rbp) + (optional (star opt_expr (|PARSE-LedPart| rbp))) + (push-reduction '|PARSE-Expr| (pop-stack-1)))) + +@ + +\defun{PARSE-LedPart}{PARSE-LedPart} +\calls{PARSE-LedPart}{PARSE-Operation} +\calls{PARSE-LedPart}{push-reduction} +\calls{PARSE-LedPart}{pop-stack-1} +<>= +(defun |PARSE-LedPart| (rbp) + (declare (special rbp)) + (and (|PARSE-Operation| '|Led| rbp) + (push-reduction '|PARSE-LedPart| (pop-stack-1)))) + +@ + +\defun{PARSE-NudPart}{PARSE-NudPart} +\calls{PARSE-NudPart}{PARSE-Operation} +\calls{PARSE-NudPart}{PARSE-Reduction} +\calls{PARSE-NudPart}{PARSE-Form} +\calls{PARSE-NudPart}{push-reduction} +\calls{PARSE-NudPart}{pop-stack-1} +\uses{PARSE-NudPart}{rbp} +<>= +(defun |PARSE-NudPart| (rbp) + (declare (special rbp)) + (and (or (|PARSE-Operation| '|Nud| rbp) (|PARSE-Reduction|) + (|PARSE-Form|)) + (push-reduction '|PARSE-NudPart| (pop-stack-1)))) + +@ + +\defun{PARSE-Operation}{PARSE-Operation} +\calls{PARSE-Operation}{match-current-token} +\calls{PARSE-Operation}{current-symbol} +\calls{PARSE-Operation}{PARSE-leftBindingPowerOf} +\calls{PARSE-Operation}{lt} +\calls{PARSE-Operation}{getl} +\calls{PARSE-Operation}{action} +\calls{PARSE-Operation}{PARSE-rightBindingPowerOf} +\calls{PARSE-Operation}{PARSE-getSemanticForm} +\calls{PARSE-Operation}{elemn} +\uses{PARSE-Operation}{ParseMode} +\uses{PARSE-Operation}{rbp} +\uses{PARSE-Operation}{tmptok} +<>= +(defun |PARSE-Operation| (|ParseMode| rbp) + (declare (special |ParseMode| rbp |tmptok|)) + (and (not (match-current-token 'identifier)) + (getl (setq |tmptok| (current-symbol)) |ParseMode|) + (lt rbp (|PARSE-leftBindingPowerOf| |tmptok| |ParseMode|)) + (action (setq rbp (|PARSE-rightBindingPowerOf| |tmptok| |ParseMode|))) + (|PARSE-getSemanticForm| |tmptok| |ParseMode| + (elemn (getl |tmptok| |ParseMode|) 5 nil)))) + +@ + \chapter{The Compiler} \section{Compiling EQ.spad} @@ -6072,8 +6183,14 @@ if \verb|$InteractiveMode| then use a null outputstream <> <> <> +<> +<> +<> <> +<> <> +<> +<> <> <> <> diff --git a/changelog b/changelog index 254a562..babceb3 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20101016 tpd src/axiom-website/patches.html 20101016.02.tpd.patch +20101016 tpd src/interp/parsing.lisp treeshake compiler +20101016 tpd books/bookvol9 treeshake compiler 20101016 tpd src/axiom-website/patches.html 20101016.01.tpd.patch 20101016 tpd src/interp/parsing.lisp treeshake compiler 20101016 tpd books/bookvol9 treeshake compiler diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index c261694..7a098c4 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -3220,5 +3220,7 @@ books/bookvol9 treeshake compiler
books/bookvol9 treeshake compiler
20101016.01.tpd.patch books/bookvol9 treeshake compiler
+20101016.02.tpd.patch +books/bookvol9 treeshake compiler
diff --git a/src/interp/parsing.lisp.pamphlet b/src/interp/parsing.lisp.pamphlet index a6267d2..06695f0 100644 --- a/src/interp/parsing.lisp.pamphlet +++ b/src/interp/parsing.lisp.pamphlet @@ -1928,27 +1928,6 @@ fnewmeta (DEFPARAMETER LABLASOC NIL) -(DEFUN |PARSE-Expression| () - (AND (|PARSE-Expr| - (|PARSE-rightBindingPowerOf| (MAKE-SYMBOL-OF PRIOR-TOKEN) - |ParseMode|)) - (PUSH-REDUCTION '|PARSE-Expression| (POP-STACK-1)))) -(trace |PARSE-Expression|) - - -(DEFUN |PARSE-Import| () - (AND (MATCH-ADVANCE-STRING "import") (MUST (|PARSE-Expr| 1000)) - (BANG FIL_TEST - (OPTIONAL - (STAR REPEATOR - (AND (MATCH-ADVANCE-STRING ",") - (MUST (|PARSE-Expr| 1000)))))) - (PUSH-REDUCTION '|PARSE-Import| - (CONS '|import| - (CONS (POP-STACK-2) (APPEND (POP-STACK-1) NIL)))))) -(trace |PARSE-Import|) - - (DEFUN |PARSE-Infix| () (AND (PUSH-REDUCTION '|PARSE-Infix| (CURRENT-SYMBOL)) (ACTION (ADVANCE-TOKEN)) (OPTIONAL (|PARSE-TokTail|)) @@ -2107,14 +2086,6 @@ fnewmeta (trace |PARSE-Iterator|) -(DEFUN |PARSE-Expr| (RBP) - (DECLARE (SPECIAL RBP)) - (AND (|PARSE-NudPart| RBP) - (OPTIONAL (STAR OPT_EXPR (|PARSE-LedPart| RBP))) - (PUSH-REDUCTION '|PARSE-Expr| (POP-STACK-1)))) -(trace |PARSE-Expr|) - - (DEFUN |PARSE-LabelExpr| () (AND (|PARSE-Label|) (MUST (|PARSE-Expr| 120)) (PUSH-REDUCTION '|PARSE-LabelExpr| @@ -2128,33 +2099,6 @@ fnewmeta (trace |PARSE-Label|) -(DEFUN |PARSE-LedPart| (RBP) - (DECLARE (SPECIAL RBP)) - (AND (|PARSE-Operation| '|Led| RBP) - (PUSH-REDUCTION '|PARSE-LedPart| (POP-STACK-1)))) -(trace |PARSE-LedPart|) - - -(DEFUN |PARSE-NudPart| (RBP) - (DECLARE (SPECIAL RBP)) - (AND (OR (|PARSE-Operation| '|Nud| RBP) (|PARSE-Reduction|) - (|PARSE-Form|)) - (PUSH-REDUCTION '|PARSE-NudPart| (POP-STACK-1)))) -(trace |PARSE-NudPart|) - - -(DEFUN |PARSE-Operation| (|ParseMode| RBP) - (DECLARE (SPECIAL |ParseMode| RBP)) - (AND (NOT (MATCH-CURRENT-TOKEN 'IDENTIFIER)) - (GETL (SETQ |tmptok| (CURRENT-SYMBOL)) |ParseMode|) - (LT RBP (|PARSE-leftBindingPowerOf| |tmptok| |ParseMode|)) - (ACTION (SETQ RBP - (|PARSE-rightBindingPowerOf| |tmptok| |ParseMode|))) - (|PARSE-getSemanticForm| |tmptok| |ParseMode| - (ELEMN (GETL |tmptok| |ParseMode|) 5 NIL)))) -(trace |PARSE-Operation|) - - (DEFUN |PARSE-leftBindingPowerOf| (X IND) (DECLARE (SPECIAL X IND)) (LET ((Y (GETL X IND))) (IF Y (ELEMN Y 3 0) 0)))