diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 7cb92f3..9adaa70 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -1,4 +1,4 @@ -x\documentclass[dvipdfm]{book} +\documentclass[dvipdfm]{book} \usepackage{hyperref} \usepackage{axiom} \usepackage{makeidx} @@ -5694,6 +5694,91 @@ and the current token (\$ttok) @ +\defun{npAtom1}{npAtom1} +\calls{npAtom1}{npPDefinition} +\calls{npAtom1}{npName} +\calls{npAtom1}{npConstTok} +\calls{npAtom1}{npDollar} +\calls{npAtom1}{npBDefinition} +\calls{npAtom1}{npFromdom} +<>= +(defun |npAtom1| () + (or + (|npPDefinition|) + (and + (or (|npName|) (|npConstTok|) (|npDollar|) (|npBDefinition|)) + (|npFromdom|)))) + +@ + +\defun{npBDefinition}{npBDefinition} +\calls{npBDefinition}{npPDefinition} +\calls{npBDefinition}{npBracketed} +\calls{npBDefinition}{npDefinitionlist} +<>= +(defun |npBDefinition| () + (or + (|npPDefinition|) + (|npBracketed| #'|npDefinitionlist|))) + +@ + +\defun{npBracketed}{npBracketed} +\calls{npBracketed}{npParened} +\calls{npBracketed}{npBracked} +\calls{npBracketed}{npBraced} +\calls{npBracketed}{npAngleBared} +<>= +(defun |npBracketed| (f) + (or + (|npParened| f) + (|npBracked| f) + (|npBraced| f) + (|npAngleBared| f))) + +@ + +\defun{npParened}{npParened} +\calls{npParened}{npEnclosed} +\calls{npParened}{pfParen} +<>= +(defun |npParened| (f) + (or (|npEnclosed| '|(| '|)| #'|pfParen| f) + (|npEnclosed| '|(\|| '|\|)| #'|pfParen| f))) + +@ + +\defun{npBracked}{npBracked} +\calls{npBracked}{npEnclosed} +\calls{npBracked}{pfBracket} +\calls{npBracked}{pfBracketBar} +<>= +(defun |npBracked| (|f|) + (or (|npEnclosed| '[ '] #'|pfBracket| |f|) + (|npEnclosed| '|[\|| '|\|]| #'|pfBracketBar| |f|))) + +@ + +\defun{npBraced}{npBraced} +\calls{npBraced}{npEnclosed} +\calls{npBraced}{pfBrace} +\calls{npBraced}{pfBraceBar} +<>= +(defun |npBraced| (f) + (or (|npEnclosed| '{ '} #'|pfBrace| f) + (|npEnclosed| '|{\|| '|\|}| #'|pfBraceBar| f))) + +@ + +\defun{npAngleBared}{npAngleBared} +\calls{npAngleBared}{npEnclosed} +\calls{npAngleBared}{pfHide} +<>= +(defun |npAngleBared| (f) + (|npEnclosed| '|<\|| '|\|>| #'|pfHide| f)) + +@ + \defun{npDefn}{npDefn} \calls{npDefn}{npEqKey} \calls{npDefn}{npPP} @@ -6223,6 +6308,12 @@ and the current token (\$ttok) @ +\defvar{npPParg} +<>= +(defvar |$npTokToNames| (list '~ '|#| '[] '{} '|[\|\|]| '|{\|\|}|)) + +@ + \defun{npId}{npId} \calls{npId}{npPush} \calls{npId}{npNext} @@ -6480,6 +6571,32 @@ This was rewritten by NAG to remove flet. @ +\defun{npEnclosed}{npEnclosed} +\calls{npEnclosed}{npEqKey} +\calls{npEnclosed}{npPush} +\calls{npEnclosed}{pfTuple} +\calls{npEnclosed}{pfListOf} +\calls{npEnclosed}{npMissingMate} +\calls{npEnclosed}{pfEnSequence} +\calls{npEnclosed}{npPop1} +\usesdollar{npEnclosed}{stok} +<>= +(defun |npEnclosed| (open close fn f) + (let (a) + (declare (special |$stok|)) + (setq a |$stok|) + (when (|npEqKey| open) + (cond + ((|npEqKey| close) + (|npPush| (funcall fn a (|pfTuple| (|pfListOf| NIL))))) + ((and (apply f nil) + (or (|npEqKey| close) + (|npMissingMate| close a))) + (|npPush| (funcall fn a (|pfEnSequence| (|npPop1|))))) + ('t nil))))) + +@ + \defun{npState}{npState} \usesdollar{npState}{stack} \usesdollar{npState}{inputStream} @@ -6899,6 +7016,14 @@ of the form ('expression expr position) @ +\defun{pfIdPos}{Construct an Id leaf node} +\calls{pfIdPos}{pfLeaf} +<>= +(defun |pfIdPos| (expr pos) + (|pfLeaf| '|id| expr pos)) + +@ + \defun{pfIdSymbol}{Return the Id part} \calls{pfIdSymbol}{tokPart} <>= @@ -7049,6 +7174,15 @@ of the form ('expression expr position) @ +\defun{pfSymbol}{Construct a Symbol leaf node} +\calls{pfSymbol}{pfLeaf} +\calls{pfSymbol}{ifcar} +<>= +(defun |pfSymbol| (expr &rest optpos) + (|pfLeaf| '|symbol| expr (ifcar optpos))) + +@ + \defun{pfSymbol?}{Is this a Symbol node?} \calls{pfSymbol?}{pfAbSynOp?} <>= @@ -7074,6 +7208,19 @@ of the form ('expression expr position) @ +\defun{pfAdd}{Construct an Add node} +\calls{pfAdd}{pfNothing} +\calls{pfAdd}{pfTree} +<>= +(defun |pfAdd| (pfbase pfaddin &rest addon) + (let (lhs) + (if addon + (setq lhs addon) + (setq lhs (|pfNothing|))) + (|pfTree| '|Add| (list pfbase pfaddin lhs)))) + +@ + \defun{pfAnd}{Construct an And node} \calls{pfAnd}{pfTree} <>= @@ -7180,6 +7327,46 @@ of the form ('expression expr position) @ +\defun{pfBrace}{Construct an application node for a brace} +\calls{pfBrace}{pfApplication} +\calls{pfBrace}{pfIdPos} +\calls{pfBrace}{tokPosn} +<>= +(defun |pfBrace| (a part) + (|pfApplication| (|pfIdPos| '{} (|tokPosn| a)) part)) + +@ + +\defun{pfBraceBar}{Construct an Application node for brace-bars} +\calls{pfBraceBar}{pfApplication} +\calls{pfBraceBar}{pfIdPos} +\calls{pfBraceBar}{tokPosn} +<>= +(defun |pfBraceBar| (a part) + (|pfApplication| (|pfIdPos| '|{\|\|}| (|tokPosn| a)) part)) + +@ + +\defun{pfBracket}{Construct an Application node for a bracket} +\calls{pfBracket}{pfApplication} +\calls{pfBracket}{pfIdPos} +\calls{pfBracket}{tokPosn} +<>= +(defun |pfBracket| (a part) + (|pfApplication| (|pfIdPos| '[] (|tokPosn| a)) part)) + +@ + +\defun{pfBracketBar}{Construct an Application node for bracket-bars} +\calls{pfBracketBar}{pfApplication} +\calls{pfBracketBar}{pfIdPos} +\calls{pfBracketBar}{tokPosn} +<>= +(defun |pfBracketBar| (a part) + (|pfApplication| (|pfIdPos| '|[\|\|]| (|tokPosn| a)) part)) + +@ + \defun{pfBreak?}{Is this a Break node?} \calls{pfBreak?}{pfAbSynOp?} <>= @@ -7328,6 +7515,15 @@ of the form ('expression expr position) @ +\defun{pfExpression}{Construct an Expression leaf node} +\calls{pfExpression}{pfLeaf} +\calls{pfExpression}{ifcar} +<>= +(defun |pfExpression| (expr &rest optpos) + (|pfLeaf| '|expression| expr (ifcar optpos))) + +@ + \defun{pfFirst}{pfFirst} <>= (defun |pfFirst| (form) @@ -7429,6 +7625,14 @@ of the form ('expression expr position) @ +\defun{pfHide}{Construct a Hide node} +\calls{pfHide}{pfTree} +<>= +(defun |pfHide| (|a| |part|) + (|pfTree| '|Hide| (list |part|))) + +@ + \defun{pfIf}{pfIf} \calls{pfIf}{pfTree} <>= @@ -7696,6 +7900,13 @@ of the form ('expression expr position) @ +\defun{pfParen}{Return the part of a parenthesised expression} +<>= +(defun |pfParen| (a part) + part) + +@ + \defun{pfPretend?}{Is this a Pretend node?} \calls{pfPretend?}{pfAbSynOp?} <>= @@ -36762,11 +36973,17 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> +<> <> +<> <> <> +<> +<> +<> <> <> <> @@ -36783,6 +37000,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -36807,6 +37025,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -36871,6 +37090,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -36885,6 +37105,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> +<> +<> <> <> <> @@ -36904,10 +37128,11 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> -<> +<> <> <> <> @@ -36919,8 +37144,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> +<> <> <> <> @@ -36968,6 +37195,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37000,6 +37228,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index b3bd0d7..e6618df 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +20100218 tpd src/axiom-website/patches.html 20100218.03.tpd.patch +20100218 tpd src/interp/ptrees.lisp treeshake +20100218 tpd src/interp/cparse.lisp treeshake +20100218 tpd books/bookvol5 treeshake cparse, ptrees 20100218 tpd src/axiom-website/patches.html 20100218.02.tpd.patch 20100218 tpd src/interp/serror.lisp merge with bookvol5, removed. 20100218 tpd src/interp/ptrees.lisp treeshake diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index ed37f8d..a00f472 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2471,5 +2471,7 @@ books/bookvol5 treeshake cparse, ptrees
src/input/pmint.input update pmint with code
20100218.02.tpd.patch books/bookvol5 treeshake cparse, ptrees, remove serror
+20100218.03.tpd.patch +books/bookvol5 treeshake cparse, ptrees
diff --git a/src/interp/cparse.lisp.pamphlet b/src/interp/cparse.lisp.pamphlet index d6ba479..d8b4b5a 100644 --- a/src/interp/cparse.lisp.pamphlet +++ b/src/interp/cparse.lisp.pamphlet @@ -13,96 +13,6 @@ (IN-PACKAGE "BOOT") -;npEnclosed(open,close,fn,f)== -; a:=$stok -; npEqKey open => -; npEqKey close => npPush FUNCALL(fn,a,pfTuple pfListOf []) -; APPLY(f,nil) and (npEqKey close or npMissingMate(close,a))=> -; npPush FUNCALL (fn,a,pfEnSequence npPop1()) -; false -; false -(DEFUN |npEnclosed| (|open| |close| |fn| |f|) - (PROG (|a|) - (DECLARE (SPECIAL |$stok|)) - (RETURN - (PROGN - (SETQ |a| |$stok|) - (COND - ((|npEqKey| |open|) - (COND - ((|npEqKey| |close|) - (|npPush| (FUNCALL |fn| |a| (|pfTuple| (|pfListOf| NIL))))) - ((AND - (APPLY |f| NIL) - (OR (|npEqKey| |close|) (|npMissingMate| |close| |a|))) - (|npPush| (FUNCALL |fn| |a| (|pfEnSequence| (|npPop1|))))) - (#0=(QUOTE T) NIL))) - (#0# NIL)))))) - -;npParened f == -; npEnclosed("(",")",function pfParen,f) or -; npEnclosed("(|","|)",function pfParen,f) -(DEFUN |npParened| (|f|) - (PROG NIL - (RETURN - (OR - (|npEnclosed| (QUOTE |(|) (QUOTE |)|) (FUNCTION |pfParen|) |f|) - (|npEnclosed| (QUOTE |(\||) (QUOTE |\|)|) (FUNCTION |pfParen|) |f|))))) - -;npBracked f == -; npEnclosed("[","]",function pfBracket,f) or -; npEnclosed("[|","|]",function pfBracketBar,f) -(DEFUN |npBracked| (|f|) - (PROG NIL - (RETURN - (OR - (|npEnclosed| (QUOTE [) (QUOTE ]) (FUNCTION |pfBracket|) |f|) - (|npEnclosed| - (QUOTE |[\||) (QUOTE |\|]|) - (FUNCTION |pfBracketBar|) |f|))))) - -;npBraced f == -; npEnclosed("{","}",function pfBrace,f) or -; npEnclosed("{|","|}",function pfBraceBar,f) -(DEFUN |npBraced| (|f|) - (PROG NIL - (RETURN - (OR - (|npEnclosed| (QUOTE {) (QUOTE }) (FUNCTION |pfBrace|) |f|) - (|npEnclosed| (QUOTE |{\||) (QUOTE |\|}|) (FUNCTION |pfBraceBar|) |f|))))) - -;npAngleBared f == -; npEnclosed("<|","|>",function pfHide,f) -(DEFUN |npAngleBared| (|f|) - (PROG NIL - (RETURN - (|npEnclosed| (QUOTE |<\||) (QUOTE |\|>|) (FUNCTION |pfHide|) |f|)))) - -;npBracketed f== -; npParened f or npBracked f or npBraced f or npAngleBared f -(DEFUN |npBracketed| (|f|) - (PROG NIL - (RETURN - (OR - (|npParened| |f|) - (|npBracked| |f|) - (|npBraced| |f|) - (|npAngleBared| |f|))))) - -;npListofFun(f,h,g)== -; if APPLY(f,nil) -; then -; if APPLY(h,nil) and (APPLY(f,nil) or npTrap()) -; then -; a:=$stack -; $stack:=nil -; while APPLY(h,nil) and (APPLY(f,nil) or npTrap()) repeat 0 -; $stack:=cons(NREVERSE $stack,a) -; npPush FUNCALL(g, [npPop3(),npPop2(),:npPop1()]) -; else -; true -; else false - ;npList(f,str1,g)== -- always produces a list, g is applied to it ; if APPLY(f,nil) ; then @@ -224,17 +134,6 @@ ;-- Parsing functions -;$npTokToNames:= ["~","#","[]","{}", "[||]","{||}"] -(EVAL-WHEN (EVAL LOAD) - (SETQ |$npTokToNames| - (LIST - (QUOTE ~) - (QUOTE |#|) - (QUOTE []) - (QUOTE {}) - (QUOTE |[\|\|]|) - (QUOTE |{\|\|}|)))) - ;npConstTok() == ; MEMQ(tokType $stok, '(integer string char float command)) => ; npPush $stok @@ -283,17 +182,6 @@ (|npAdd| (|pfNothing|)) (|npWith| (|pfNothing|)))))) -;npAtom1()== npPDefinition() or ((npName() or npConstTok() or -; npDollar() or npBDefinition()) and npFromdom()) -(DEFUN |npAtom1| () - (PROG NIL - (RETURN - (OR - (|npPDefinition|) - (AND - (OR (|npName|) (|npConstTok|) (|npDollar|) (|npBDefinition|)) - (|npFromdom|)))))) - ;npAtom2()== (npInfixOperator() or npAmpersand() or npPrefixColon()) ; and npFromdom() (DEFUN |npAtom2| () @@ -1172,15 +1060,6 @@ (|npParenthesized| (FUNCTION |npDefinitionlist|)) (|npPush| (|pfEnSequence| (|npPop1|))))))) -;npBDefinition()== npPDefinition() or -; npBracketed function npDefinitionlist -(DEFUN |npBDefinition| () - (PROG NIL - (RETURN - (OR - (|npPDefinition|) - (|npBracketed| (FUNCTION |npDefinitionlist|)))))) - ;npTypeVariable()== npParenthesized function npTypeVariablelist or ; npSignatureDefinee() and npPush pfListOf [npPop1()] (DEFUN |npTypeVariable| () diff --git a/src/interp/ptrees.lisp.pamphlet b/src/interp/ptrees.lisp.pamphlet index e9f5692..7f1f7ab 100644 --- a/src/interp/ptrees.lisp.pamphlet +++ b/src/interp/ptrees.lisp.pamphlet @@ -19,23 +19,6 @@ ;--% LEAVES -;pfIdPos(expr,pos) == pfLeaf('id,expr,pos) - -(DEFUN |pfIdPos| (|expr| |pos|) - (PROG () (RETURN (|pfLeaf| '|id| |expr| |pos|)))) - -;pfExpression(expr, :optpos) == -; pfLeaf("expression", expr, IFCAR optpos) - -(DEFUN |pfExpression| (|expr| &REST |optpos|) - (PROG () (RETURN (|pfLeaf| '|expression| |expr| (IFCAR |optpos|))))) - -;pfSymbol(expr, :optpos) == -; pfLeaf("symbol", expr, IFCAR optpos) - -(DEFUN |pfSymbol| (|expr| &REST |optpos|) - (PROG () (RETURN (|pfLeaf| '|symbol| |expr| (IFCAR |optpos|))))) - ;--% TREES ;-- parser interface functions ;-- these are potential sources of trouble in macro expansion @@ -77,41 +60,6 @@ (DEFUN |pfReturnNoName| (|value|) (PROG () (RETURN (|pfReturn| |value| (|pfNothing|))))) -;pfBrace(a,part)==pfApplication(pfIdPos( "{}",tokPosn a),part) - -(DEFUN |pfBrace| (|a| |part|) - (PROG () - (RETURN (|pfApplication| (|pfIdPos| '{} (|tokPosn| |a|)) |part|)))) - -;pfBracket(a,part) == pfApplication(pfIdPos( "[]",tokPosn a),part) - -(DEFUN |pfBracket| (|a| |part|) - (PROG () - (RETURN (|pfApplication| (|pfIdPos| '[] (|tokPosn| |a|)) |part|)))) - -;pfBraceBar(a,part)==pfApplication(pfIdPos( "{||}",tokPosn a),part) - -(DEFUN |pfBraceBar| (|a| |part|) - (PROG () - (RETURN - (|pfApplication| (|pfIdPos| '|{\|\|}| (|tokPosn| |a|)) |part|)))) - -;pfBracketBar(a,part) == pfApplication(pfIdPos( "[||]",tokPosn a),part) - -(DEFUN |pfBracketBar| (|a| |part|) - (PROG () - (RETURN - (|pfApplication| (|pfIdPos| '|[\|\|]| (|tokPosn| |a|)) |part|)))) - -;pfHide(a,part) == pfTree("Hide",[part]) - -(DEFUN |pfHide| (|a| |part|) - (PROG () (RETURN (|pfTree| '|Hide| (LIST |part|))))) - -;pfParen(a,part)==part - -(DEFUN |pfParen| (|a| |part|) (PROG () (RETURN |part|))) - ;pfSpread(l,t)== [pfTyped(i,t) for i in l] (DEFUN |pfSpread| (|l| |t|) @@ -173,21 +121,6 @@ ; pfWhere? pf or _ ; pfWith? pf -;-- Add := (Base: [Typed], Addin: Expr) - -;pfAdd(pfbase, pfaddin,:addon) == -; lhs := if addon -; then first addon -; else pfNothing() -; pfTree('Add, [pfbase, pfaddin,lhs]) - -(DEFUN |pfAdd| (|pfbase| |pfaddin| &REST |addon|) - (PROG (|lhs|) - (RETURN - (PROGN - (SETQ |lhs| (COND (|addon| (CAR |addon|)) ('T (|pfNothing|)))) - (|pfTree| '|Add| (LIST |pfbase| |pfaddin| |lhs|)))))) - ;-- With := (Base: [Typed], Within: [WithPart]) ;pfWith(pfbase, pfwithin,pfwithon) ==