diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 50d2111..92b5129 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -5696,6 +5696,48 @@ and the current token (\$ttok) @ +\defun{npListing}{npListing} +\calls{npListing}{npList} +\calls{npListing}{pfListOf} +<>= +(defun |npListing| (p) + (|npList| p 'comma #'|pfListOf|)) + +@ + +\defun{npList}{Always produces a list, fn is applied to it} +\calls{npList}{npEqKey} +\calls{npList}{npTrap} +\calls{npList}{npPush} +\calls{npList}{npPop3} +\calls{npList}{npPop2} +\calls{npList}{npPop1} +\usesdollar{npList}{stack} +<>= +(defun |npList| (f str1 fn) + (let (a) + (declare (special |$stack|)) + (cond + ((apply f nil) + (cond + ((and (|npEqKey| str1) + (or (|npEqKey| 'backset) t) + (or (apply f nil) (|npTrap|))) + (setq a |$stack|) + (setq |$stack| nil) + (do () ; while .. do nothing + ((not + (and (|npEqKey| str1) + (or (|npEqKey| 'backset) t) + (or (apply f nil) (|npTrap|)))) + nil)) + (setq |$stack| (cons (nreverse |$stack|) a)) + (|npPush| (funcall fn (cons (|npPop3|) (cons (|npPop2|) (|npPop1|)))))) + (t (|npPush| (funcall fn (list (|npPop1|))))))) + (t (|npPush| (funcall fn nil)))))) + +@ + \defun{npSigItem}{npSigItem} \calls{npSigItem}{npTypeVariable} \calls{npSigItem}{npSigDecl} @@ -5818,6 +5860,56 @@ and the current token (\$ttok) @ +\defun{npInfixOperator}{npInfixOperator} +\calls{npInfixOperator}{npInfixOp} +\calls{npInfixOperator}{npState} +\calls{npInfixOperator}{npEqKey} +\calls{npInfixOperator}{npInfixOp} +\calls{npInfixOperator}{npPush} +\calls{npInfixOperator}{pfSymb} +\calls{npInfixOperator}{npPop1} +\calls{npInfixOperator}{tokPosn} +\calls{npInfixOperator}{npRestore} +\calls{npInfixOperator}{tokConstruct} +\calls{npInfixOperator}{tokPart} +\usesdollar{npInfixOperator}{stok} +<>= +(defun |npInfixOperator| () + (let (b a) + (declare (special |$stok|)) + (or (|npInfixOp|) + (progn + (setq a (|npState|)) + (setq b |$stok|) + (cond + ((and (|npEqKey| '|'|) (|npInfixOp|)) + (|npPush| (|pfSymb| (|npPop1|) (|tokPosn| b)))) + (t + (|npRestore| a) + (cond + ((and (|npEqKey| 'backquote) (|npInfixOp|)) + (setq a (|npPop1|)) + (|npPush| (|tokConstruct| '|idsy| (|tokPart| a) (|tokPosn| a)))) + (t + (|npRestore| a) + nil)))))))) + +@ + +\defun{npInfixOp}{npInfixOp} +\calls{npInfixOp}{npPushId} +\usesdollar{npInfixOp}{ttok} +\usesdollar{npInfixOp}{stok} +<>= +(defun |npInfixOp| () + (declare (special |$ttok| |$stok|)) + (and + (eq (caar |$stok|) '|key|) + (get |$ttok| 'infgeneric) + (|npPushId|))) + +@ + \defun{npPrefixColon}{npPrefixColon} \calls{npPrefixColon}{npEqPeek} \calls{npPrefixColon}{npPush} @@ -5864,6 +5956,15 @@ and the current token (\$ttok) @ +\defun{npAnyNo}{npAnyNo} +fn must transform the head of the stack +<>= +(defun |npAnyNo| (fn) + (do () ((not (apply fn nil)))) ; while apply do... + t) + +@ + \defun{npSelector}{npSelector} \calls{npSelector}{npEqKey} \calls{npSelector}{npPrimary} @@ -6023,6 +6124,37 @@ and the current token (\$ttok) @ +\defun{npStatement}{npStatement} +\calls{npStatement}{npExpress} +\calls{npStatement}{npLoop} +\calls{npStatement}{npIterate} +\calls{npStatement}{npReturn} +\calls{npStatement}{npBreak} +\calls{npStatement}{npFree} +\calls{npStatement}{npImport} +\calls{npStatement}{npInline} +\calls{npStatement}{npLocal} +\calls{npStatement}{npExport} +\calls{npStatement}{npTyping} +\calls{npStatement}{npVoid} +<>= +(defun |npStatement| () + (or + (|npExpress|) + (|npLoop|) + (|npIterate|) + (|npReturn|) + (|npBreak|) + (|npFree|) + (|npImport|) + (|npInline|) + (|npLocal|) + (|npExport|) + (|npTyping|) + (|npVoid|))) + +@ + \defun{npImport}{npImport} \calls{npImport}{npAndOr} \calls{npImport}{npQualTypelist} @@ -6033,6 +6165,20 @@ and the current token (\$ttok) @ +\defun{npAndOr}{npAndOr} +\calls{npAndOr}{npEqKey} +\calls{npAndOr}{npTrap} +\calls{npAndOr}{npPush} +\calls{npAndOr}{npPop1} +<>= +(defun |npAndOr| (keyword p f) + (and + (|npEqKey| keyword) + (or (apply p nil) (|npTrap|)) + (|npPush| (funcall f (|npPop1|))))) + +@ + \defun{npEncAp}{npEncAp} \calls{npEncAp}{npAnyNo} \calls{npEncAp}{npEncl} @@ -6661,6 +6807,34 @@ and the current token (\$ttok) @ +\defun{npInterval}{} +\calls{npInterval}{npArith} +\calls{npInterval}{npSegment} +\calls{npInterval}{npEqPeek} +\calls{npInterval}{npPush} +\calls{npInterval}{pfApplication} +\calls{npInterval}{npPop1} +\calls{npInterval}{pfInfApplication} +\calls{npInterval}{npPop2} +<>= +(defun |npInterval| () + (and + (|npArith|) + (or + (and + (|npSegment|) + (or + (and + (|npEqPeek| 'bar) + (|npPush| (|pfApplication| (|npPop1|) (|npPop1|)))) + (and + (|npArith|) + (|npPush| (|pfInfApplication| (|npPop2|) (|npPop2|) (|npPop1|)))) + (|npPush| (|pfApplication| (|npPop1|) (|npPop1|))))) + t))) + +@ + \defun{npAmpersandFrom}{npAmpersandFrom} \calls{npAmpersandFrom}{npAmpersand} \calls{npAmpersandFrom}{npFromdom} @@ -7078,6 +7252,30 @@ This was rewritten by NAG to remove flet. @ +\defun{npVariablelist}{npVariablelist} +\calls{npVariablelist}{npListing} +\calls{npVariablelist}{npVariableName} +<>= +(defun |npVariablelist| () + (|npListing| #'|npVariableName|)) + +@ + +\defun{npVariableName}{npVariableName} +\calls{npVariableName}{npName} +\calls{npVariableName}{npDecl} +\calls{npVariableName}{npPush} +\calls{npVariableName}{pfTyped} +\calls{npVariableName}{npPop1} +\calls{npVariableName}{pfNothing} +<>= +(defun |npVariableName| () + (and + (|npName|) + (or (|npDecl|) (|npPush| (|pfTyped| (|npPop1|) (|pfNothing|)))))) + +@ + \defun{npParenthesized}{npParenthesized} \calls{npParenthesized}{npParenthesize} <>= @@ -7188,6 +7386,16 @@ This was rewritten by NAG to remove flet. @ +\defun{npColon}{npColon} +\calls{npColon}{npTypified} +\calls{npColon}{npAnyNo} +\calls{npColon}{npTagged} +<>= +(defun |npColon| () + (and (|npTypified|) (|npAnyNo| #'|npTagged|))) + +@ + \defun{npListofFun}{npListofFun} \calls{npListofFun}{npTrap} \calls{npListofFun}{npPush} @@ -37579,7 +37787,9 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> +<> <> <> <> @@ -37598,6 +37808,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37631,7 +37842,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> +<> <> <> <> @@ -37639,7 +37853,9 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> +<> <> <> <> @@ -37688,6 +37904,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37699,6 +37916,8 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> <> diff --git a/changelog b/changelog index c364418..57e6dfa 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,6 @@ +20100222 tpd src/axiom-website/patches.html 20100222.01.tpd.patch +20100222 tpd src/interp/cparse.lisp treeshake +20100222 tpd books/bookvol5 treeshake cparse 20100221 tpd src/axiom-website/patches.html 20100221.01.tpd.patch 20100221 tpd src/input/unittest2.input fix broken credit test 20100220 tpd src/axiom-website/patches.html 20100220.02.tpd.patch diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 82cae05..75bfde3 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2483,5 +2483,7 @@ books/bookvol5 treeshake cparse, ptrees
books/bookvol5 treeshake cparse, ptrees
20100221.01.tpd.patch src/input/unittest2.input fix broken credit test
+20100222.01.tpd.patch +books/bookvol5 treeshake cparse
diff --git a/src/interp/cparse.lisp.pamphlet b/src/interp/cparse.lisp.pamphlet index 7d52f2e..bc3eb7e 100644 --- a/src/interp/cparse.lisp.pamphlet +++ b/src/interp/cparse.lisp.pamphlet @@ -13,125 +13,6 @@ (IN-PACKAGE "BOOT") -;npList(f,str1,g)== -- always produces a list, g is applied to it -; if APPLY(f,nil) -; then -; if npEqKey str1 and (npEqKey "BACKSET" or true) -; and (APPLY(f,nil) or npTrap()) -; then -; a:=$stack -; $stack:=nil -; while npEqKey str1 and (npEqKey "BACKSET" or true) and -; (APPLY(f,nil) or npTrap()) repeat 0 -; $stack:=cons(NREVERSE $stack,a) -; npPush FUNCALL(g, [npPop3(),npPop2(),:npPop1()]) -; else -; npPush FUNCALL(g, [npPop1()]) -; else npPush FUNCALL(g, []) -; -(DEFUN |npList| (|f| |str1| |g|) - (PROG (|a|) - (DECLARE (SPECIAL |$stack|)) - (RETURN - (COND - ((APPLY |f| NIL) - (COND - ((AND - (|npEqKey| |str1|) - (OR (|npEqKey| (QUOTE BACKSET)) T) - (OR (APPLY |f| NIL) (|npTrap|))) - (SETQ |a| |$stack|) - (SETQ |$stack| NIL) - ((LAMBDA () - (LOOP - (COND - ((NOT - (AND - (|npEqKey| |str1|) - (OR (|npEqKey| (QUOTE BACKSET)) T) - (OR (APPLY |f| NIL) (|npTrap|)))) - (RETURN NIL)) - ((QUOTE T) 0))))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) - (|npPush| - (FUNCALL |g| (CONS (|npPop3|) (CONS (|npPop2|) (|npPop1|)))))) - (#0=(QUOTE T) (|npPush| (FUNCALL |g| (LIST (|npPop1|))))))) - (#0# (|npPush| (FUNCALL |g| NIL))))))) - - -;-- s must transform the head of the stack -; -;npAnyNo s== -; while APPLY(s,nil) repeat 0 -; true -(DEFUN |npAnyNo| (|s|) - (PROG NIL - (RETURN - (PROGN - ((LAMBDA () - (LOOP - (COND - ((NOT (APPLY |s| NIL)) (RETURN NIL)) - ((QUOTE T) 0))))) - T)))) - -;npAndOr(keyword,p,f)== -; npEqKey keyword and (APPLY(p,nil) or npTrap()) -; and npPush FUNCALL(f, npPop1()) -(DEFUN |npAndOr| (|keyword| |p| |f|) - (PROG NIL - (RETURN - (AND - (|npEqKey| |keyword|) - (OR (APPLY |p| NIL) (|npTrap|)) - (|npPush| (FUNCALL |f| (|npPop1|))))))) - -;npInfixOp()== -; EQ(CAAR $stok,"key") and -; GET($ttok,"INFGENERIC") and npPushId() -(DEFUN |npInfixOp| () - (PROG NIL - (DECLARE (SPECIAL |$ttok| |$stok|)) - (RETURN - (AND - (EQ (CAAR |$stok|) (QUOTE |key|)) - (GET |$ttok| (QUOTE INFGENERIC)) - (|npPushId|))))) - -;npInfixOperator()== npInfixOp() or -; a:=npState() -; b:=$stok -; npEqKey "'" and npInfixOp() => -; npPush pfSymb (npPop1 (),tokPosn b) -; npRestore a -; npEqKey "BACKQUOTE" and npInfixOp() => -; a:=npPop1() -; npPush tokConstruct("idsy",tokPart a,tokPosn a) -; npRestore a -; false -(DEFUN |npInfixOperator| () - (PROG (|b| |a|) - (DECLARE (SPECIAL |$stok|)) - (RETURN - (OR - (|npInfixOp|) - (PROGN - (SETQ |a| (|npState|)) - (SETQ |b| |$stok|) - (COND - ((AND (|npEqKey| (QUOTE |'|)) (|npInfixOp|)) - (|npPush| (|pfSymb| (|npPop1|) (|tokPosn| |b|)))) - (#0=(QUOTE T) - (PROGN - (|npRestore| |a|) - (COND - ((AND (|npEqKey| (QUOTE BACKQUOTE)) (|npInfixOp|)) - (PROGN - (SETQ |a| (|npPop1|)) - (|npPush| - (|tokConstruct| (QUOTE |idsy|) (|tokPart| |a|) (|tokPosn| |a|))))) - (#0# (PROGN (|npRestore| |a|) NIL))))))))))) - ;-- Parsing functions ;npTypedForm1(sy,fn) == @@ -199,12 +80,6 @@ (RETURN (|npTypedForm1| (QUOTE COLON) (FUNCTION |pfTagged|))))) -;npColon () == npTypified() and npAnyNo function npTagged -(DEFUN |npColon| () - (PROG NIL - (RETURN - (AND (|npTypified|) (|npAnyNo| (FUNCTION |npTagged|)))))) - ;npPower() == npRightAssoc('(POWER CARAT),function npColon) (DEFUN |npPower| () (PROG NIL @@ -264,30 +139,6 @@ (RETURN (AND (|npEqPeek| (QUOTE SEG)) (|npPushId|) (|npFromdom|))))) -;npInterval()== -; npArith() and -; (npSegment() and ((npEqPeek "BAR" -; and npPush(pfApplication(npPop1(),npPop1()))) or -; (npArith() and npPush(pfInfApplication(npPop2(),npPop2(),npPop1()))) -; or npPush(pfApplication(npPop1(),npPop1()))) or true) -(DEFUN |npInterval| () - (PROG NIL - (RETURN - (AND - (|npArith|) - (OR - (AND - (|npSegment|) - (OR - (AND - (|npEqPeek| (QUOTE BAR)) - (|npPush| (|pfApplication| (|npPop1|) (|npPop1|)))) - (AND - (|npArith|) - (|npPush| (|pfInfApplication| (|npPop2|) (|npPop2|) (|npPop1|)))) - (|npPush| (|pfApplication| (|npPop1|) (|npPop1|))))) - T))))) - ;npConditionalStatement()==npConditional function npQualifiedDefinition (DEFUN |npConditionalStatement| () (PROG NIL @@ -370,36 +221,6 @@ (|npSuchThat|) (|npWhile|))))) -;npStatement()== -; npExpress() or -; npLoop() or -; npIterate() or -; npReturn() or -; npBreak() or -; npFree() or -; npImport() or -; npInline() or -; npLocal() or -; npExport() or -; npTyping() or -; npVoid() -(DEFUN |npStatement| () - (PROG NIL - (RETURN - (OR - (|npExpress|) - (|npLoop|) - (|npIterate|) - (|npReturn|) - (|npBreak|) - (|npFree|) - (|npImport|) - (|npInline|) - (|npLocal|) - (|npExport|) - (|npTyping|) - (|npVoid|))))) - ;npMDEF()== npBackTrack(function npStatement,"MDEF",function npMDEFinition) (DEFUN |npMDEF| () (PROG NIL @@ -648,27 +469,6 @@ (OR (|npType|) (|npTrap|)) (|npPush| (|pfTyped| (|npPop2|) (|npPop1|))))))) -;npVariableName()==npName() and -; (npDecl() or npPush pfTyped(npPop1(),pfNothing())) -(DEFUN |npVariableName| () - (PROG NIL - (RETURN - (AND - (|npName|) - (OR (|npDecl|) (|npPush| (|pfTyped| (|npPop1|) (|pfNothing|)))))))) - -;npVariablelist()== npListing function npVariableName -(DEFUN |npVariablelist| () - (PROG NIL - (RETURN - (|npListing| (FUNCTION |npVariableName|))))) - -;npListing (p)==npList(p,"COMMA",function pfListOf) -(DEFUN |npListing| (|p|) - (PROG NIL - (RETURN - (|npList| |p| (QUOTE COMMA) (FUNCTION |pfListOf|))))) - ;npQualified(f)== ; if FUNCALL f ; then