diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 5c2c1db..09fb04a 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -1233,7 +1233,7 @@ character. Otherwise, it returns nil. \calls{next}{next1} <>= (defun |next| (f s) - (|Delay| (function |next1|) (list f s))) + (|Delay| #'|next1| (list f s))) @ @@ -2216,9 +2216,9 @@ sameUnionBranch(uArg, m) == (declare (special |$lines|)) (setq |$lines| (|incStream| |st| |name|)) (|intloopProcess| |n| NIL - (|next| (function |intloopEchoParse|) - (|next| (function |insertpile|) - (|next| (function |lineoftoks|) + (|next| #'|intloopEchoParse| + (|next| #'|insertpile| + (|next| #'|lineoftoks| |$lines|)))))) @ @@ -2664,9 +2664,9 @@ contiguous comment spanning enough lines to overflow the stack. (declare (special |$lines|)) (setq |$lines| (|incStream| st name)) (|ncloopProcess| n nil - (|next| (function |ncloopEchoParse|) - (|next| (function |insertpile|) - (|next| (function |lineoftoks|) + (|next| #'|ncloopEchoParse| + (|next| #'|insertpile| + (|next| #'|lineoftoks| |$lines|)))))) @ @@ -2697,7 +2697,7 @@ contiguous comment spanning enough lines to overflow the stack. \calls{incZip}{incZip1} <>= (defun |incZip| (g f1 f2) - (|Delay| (function |incZip1|) (list g f1 f2))) + (|Delay| #'|incZip1| (list g f1 f2))) @ @@ -2725,7 +2725,7 @@ contiguous comment spanning enough lines to overflow the stack. \calls{incIgen}{incIgen1} <>= (defun |incIgen| (n) - (|Delay| (function |incIgen1|) (list n))) + (|Delay| #'|incIgen1| (list n))) @ @@ -2786,7 +2786,7 @@ contiguous comment spanning enough lines to overflow the stack. \calls{include}{incLude1} <>= (defun |incLude| (eb ss ln ufos states) - (|Delay| (function |incLude1|) (list eb ss ln ufos states))) + (|Delay| #'|incLude1| (list eb ss ln ufos states))) @ @@ -3161,7 +3161,7 @@ contiguous comment spanning enough lines to overflow the stack. \calls{incAppend}{incAppend1} <>= (defun |incAppend| (x y) - (|Delay| (function |incAppend1|) (list x y))) + (|Delay| #'|incAppend1| (list x y))) @ @@ -3736,7 +3736,7 @@ Note that incRgen1 recursively calls this function. \calls{incRgen}{incRgen1} <>= (defun |incRgen| (s) - (|Delay| (function |incRgen1|) (list s))) + (|Delay| #'|incRgen1| (list s))) @ @@ -5437,6 +5437,24 @@ and the current token (\$ttok) @ +\defun{npBackTrack}{npBackTrack} +\calls{npBackTrack}{npState} +\calls{npBackTrack}{npEqPeek} +\calls{npBackTrack}{npRestore} +\calls{npBackTrack}{npTrap} +<>= +(defun |npBackTrack| (p1 p2 p3) + (let (a) + (setq a (|npState|)) + (when (apply p1 nil) + (cond + ((|npEqPeek| p2) + (|npRestore| a) + (or (apply p3 nil) (|npTrap|))) + (t t))))) + +@ + \defun{npGives}{npGives} \calls{npGives}{npBackTrack} \calls{npGives}{npExit} @@ -5494,6 +5512,24 @@ and the current token (\$ttok) @ +\defun{npMatch}{npMatch} +\calls{npMatch}{npLeftAssoc} +\calls{npMatch}{npSuch} +<>= +(defun |npMatch| () + (|npLeftAssoc| '(is isnt) #'|npSuch|)) + +@ + +\defun{npSuch}{npSuch} +\calls{npSuch}{npLeftAssoc} +\calls{npSuch}{npLogical} +<>= +(defun |npSuch| () + (|npLeftAssoc| '(bar) #'|npLogical|)) + +@ + \defun{npWith}{npWith} \calls{npWith}{npEqKey} \calls{npWith}{npState} @@ -5632,6 +5668,79 @@ and the current token (\$ttok) @ +\defun{npPrimary}{npPrimary} +\calls{npPrimary}{npPrimary1} +\calls{npPrimary}{npPrimary2} +<>= +(defun |npPrimary| () + (or (|npPrimary1|) (|npPrimary2|))) + +@ + +\defun{npPrimary2}{npPrimary2} +\calls{npPrimary2}{npEncAp} +\calls{npPrimary2}{npAtom2} +\calls{npPrimary2}{npAdd} +\calls{npPrimary2}{pfNothing} +\calls{npPrimary2}{npWith} +<>= +(defun |npPrimary2| () + (or + (|npEncAp| #'|npAtom2|) + (|npAdd| (|pfNothing|)) + (|npWith| (|pfNothing|)))) + +@ + +\defun{npADD}{npADD} +\calls{npADD}{npType} +\calls{npADD}{npPop1} +\calls{npADD}{npAdd} +\calls{npADD}{npPush} +<>= +(defun |npADD| () + (let (a) + (and + (|npType|) + (progn + (setq a (|npPop1|)) + (or + (|npAdd| a) + (|npPush| a)))))) + +@ + +\defun{npAtom2}{npAtom2} +\calls{npAtom2}{npInfixOperator} +\calls{npAtom2}{npAmpersand} +\calls{npAtom2}{npPrefixColon} +\calls{npAtom2}{npFromdom} +<>= +(defun |npAtom2| () + (and + (or (|npInfixOperator|) (|npAmpersand|) (|npPrefixColon|)) + (|npFromdom|))) + +@ + +\defun{npPrefixColon}{npPrefixColon} +\calls{npPrefixColon}{npEqPeek} +\calls{npPrefixColon}{npPush} +\calls{npPrefixColon}{tokConstruct} +\calls{npPrefixColon}{tokPosn} +\calls{npPrefixColon}{npNext} +\usesdollar{npPrefixColon}{stok} +<>= +(defun |npPrefixColon| () + (declare (special |$stok|)) + (and + (|npEqPeek| 'colon) + (progn + (|npPush| (|tokConstruct| '|id| '|:| (|tokPosn| |$stok|))) + (|npNext|)))) + +@ + \defun{npApplication}{npApplication} \calls{npApplication}{npDotted} \calls{npApplication}{npPrimary} @@ -5652,6 +5761,31 @@ and the current token (\$ttok) @ +\defun{npDotted}{npDotted} +\calls{npDotted}{} +<>= +(defun |npDotted| (f) + (and (apply f nil) (|npAnyNo| #'|npSelector|))) + +@ + +\defun{npSelector}{npSelector} +\calls{npSelector}{npEqKey} +\calls{npSelector}{npPrimary} +\calls{npSelector}{npTrap} +\calls{npSelector}{npPush} +\calls{npSelector}{pfApplication} +\calls{npSelector}{npPop2} +\calls{npSelector}{npPop1} +<>= +(defun |npSelector| () + (and + (|npEqKey| 'dot) + (or (|npPrimary|) (|npTrap|)) + (|npPush| (|pfApplication| (|npPop2|) (|npPop1|))))) + +@ + \defun{npApplication2}{npApplication2} \calls{npApplication2}{npDotted} \calls{npApplication2}{npPrimary1} @@ -5694,6 +5828,114 @@ and the current token (\$ttok) @ +\defun{npLet}{npLet} +\calls{npLet}{npLetQualified} +\calls{npLet}{npDefinitionOrStatement} +<>= +(defun |npLet| () + (|npLetQualified| #'|npDefinitionOrStatement|)) + +@ + +\defun{npLetQualified}{npLetQualified} +\calls{npLetQualified}{npEqKey} +\calls{npLetQualified}{npDefinition} +\calls{npLetQualified}{npTrap} +\calls{npLetQualified}{npCompMissing} +\calls{npLetQualified}{npPush} +\calls{npLetQualified}{pfWhere} +\calls{npLetQualified}{npPop2} +\calls{npLetQualified}{npPop1} +<>= +(defun |npLetQualified| (f) + (and + (|npEqKey| 'let) + (or (|npDefinition|) (|npTrap|)) + (|npCompMissing| 'in) + (or #'f (|npTrap|)) + (|npPush| (|pfWhere| (|npPop2|) (|npPop1|))))) + +@ + +\defun{npDefinition}{npDefinition} +\calls{npDefinition}{npPP} +\calls{npDefinition}{npDefinitionItem} +\calls{npDefinition}{npPush} +\calls{npDefinition}{pfSequenceToList} +\calls{npDefinition}{npPop1} +<>= +(defun |npDefinition| () + (and + (|npPP| #'|npDefinitionItem|) + (|npPush| (|pfSequenceToList| (|npPop1|))))) + +@ + +\defun{npDefinitionItem}{npDefinitionItem} +\calls{npDefinitionItem}{npTyping} +\calls{npDefinitionItem}{npImport} +\calls{npDefinitionItem}{npState} +\calls{npDefinitionItem}{npStatement} +\calls{npDefinitionItem}{npEqPeek} +\calls{npDefinitionItem}{npRestore} +\calls{npDefinitionItem}{npDef} +\calls{npDefinitionItem}{npMacro} +\calls{npDefinitionItem}{npDefn} +\calls{npDefinitionItem}{npTrap} +<>= +(defun |npDefinitionItem| () + (let (a) + (or (|npTyping|) + (|npImport|) + (progn + (setq a (|npState|)) + (cond + ((|npStatement|) + (cond + ((|npEqPeek| 'def) + (|npRestore| a) + (|npDef|)) + (t + (|npRestore| a) + (or (|npMacro|) (|npDefn|))))) + (t (|npTrap|))))))) + +@ + +\defun{npImport}{npImport} +\calls{npImport}{npAndOr} +\calls{npImport}{npQualTypelist} +\calls{npImport}{pfImport} +<>= +(defun |npImport| () + (|npAndOr| 'import #'|npQualTypelist| #'|pfImport|)) + +@ + +\defun{npEncAp}{npEncAp} +\calls{npEncAp}{npAnyNo} +\calls{npEncAp}{npEncl} +\calls{npEncAp}{npFromdom} +<>= +(defun |npEncAp| (f) + (and (apply f nil) (|npAnyNo| #'|npEncl|) (|npFromdom|))) + +@ + +\defun{npEncl}{npEncl} +\calls{npEncl}{npBDefinition} +\calls{npEncl}{npPush} +\calls{npEncl}{pfApplication} +\calls{npEncl}{npPop2} +\calls{npEncl}{npPop1} +<>= +(defun |npEncl| () + (and + (|npBDefinition|) + (|npPush| (|pfApplication| (|npPop2|) (|npPop1|))))) + +@ + \defun{npAtom1}{npAtom1} \calls{npAtom1}{npPDefinition} \calls{npAtom1}{npName} @@ -5711,6 +5953,57 @@ and the current token (\$ttok) @ +\defun{npDollar}{npDollar} +\calls{npDollar}{npEqPeek} +\calls{npDollar}{npPush} +\calls{npDollar}{tokConstruct} +\calls{npDollar}{tokPosn} +\calls{npDollar}{npNext} +\usesdollar{npDollar}{stok} +<>= +(defun |npDollar| () + (declare (special |$stok|)) + (and (|npEqPeek| '$) + (progn + (|npPush| (|tokConstruct| '|id| '$ (|tokPosn| |$stok|))) + (|npNext|)))) + +@ + +\defun{npConstTok}{npConstTok} +\calls{npConstTok}{memq} +\calls{npConstTok}{tokType} +\calls{npConstTok}{npPush} +\calls{npConstTok}{npNext} +\calls{npConstTok}{npEqPeek} +\calls{npConstTok}{npState} +\calls{npConstTok}{npPrimary1} +\calls{npConstTok}{pfSymb} +\calls{npConstTok}{npPop1} +\calls{npConstTok}{tokPosn} +\calls{npConstTok}{npRestore} +\usesdollar{npConstTok}{stok} +<>= +(defun |npConstTok| () + (let (b a) + (declare (special |$stok|)) + (cond + ((memq (|tokType| |$stok|) '(|integer| |string| |char| |float| |command|)) + (|npPush| |$stok|) + (|npNext|)) + ((|npEqPeek| '|'|) + (setq a |$stok|) + (setq b (|npState|)) + (|npNext|) + (cond + ((and (|npPrimary1|) + (|npPush| (|pfSymb| (|npPop1|) (|tokPosn| a)))) + t) + (t (|npRestore| b) nil))) + (t nil)))) + +@ + \defun{npBDefinition}{npBDefinition} \calls{npBDefinition}{npPDefinition} \calls{npBDefinition}{npBracketed} @@ -5753,9 +6046,9 @@ and the current token (\$ttok) \calls{npBracked}{pfBracket} \calls{npBracked}{pfBracketBar} <>= -(defun |npBracked| (|f|) - (or (|npEnclosed| '[ '] #'|pfBracket| |f|) - (|npEnclosed| '|[\|| '|\|]| #'|pfBracketBar| |f|))) +(defun |npBracked| (f) + (or (|npEnclosed| '[ '] #'|pfBracket| f) + (|npEnclosed| '|[\|| '|\|]| #'|pfBracketBar| f))) @ @@ -5841,12 +6134,12 @@ and the current token (\$ttok) \calls{npPileBracketed}{pfPile} \calls{npPileBracketed}{npPop1} <>= -(defun |npPileBracketed| (|f|) +(defun |npPileBracketed| (f) (cond ((|npEqKey| 'settab) (cond ((|npEqKey| 'backtab) (|npPush| (|pfNothing|))) ; never happens - ((and (apply |f| nil) + ((and (apply f nil) (or (|npEqKey| 'backtab) (|npMissing| '|backtab|))) (|npPush| (|pfPile| (|npPop1|)))) (t nil))) @@ -6238,6 +6531,15 @@ and the current token (\$ttok) @ +\defun{npBy}{npBy} +\calls{npBy}{npLeftAssoc} +\calls{npBy}{npInterval} +<>= +(defun |npBy| () + (|npLeftAssoc| '(by) #'|npInterval|)) + +@ + \defun{npAmpersandFrom}{npAmpersandFrom} \calls{npAmpersandFrom}{npAmpersand} \calls{npAmpersandFrom}{npFromdom} @@ -6707,6 +7009,64 @@ This was rewritten by NAG to remove flet. @ +\defun{npPileExit}{npPileExit} +\calls{npPileExit}{npAssign} +\calls{npPileExit}{npEqKey} +\calls{npPileExit}{npStatement} +\calls{npPileExit}{npPush} +\calls{npPileExit}{pfExit} +\calls{npPileExit}{npPop2} +\calls{npPileExit}{npPop1} +<>= +(defun |npPileExit| () + (and + (|npAssign|) + (or (|npEqKey| 'exit) (|npTrap|)) + (or (|npStatement|) (|npTrap|)) + (|npPush| (|pfExit| (|npPop2|) (|npPop1|))))) + +@ + +\defun{npAssign}{npAssign} +\calls{npAssign}{npBackTrack} +\calls{npAssign}{npMDEF} +\calls{npAssign}{npAssignment} +<>= +(defun |npAssign| () + (|npBackTrack| #'|npMDEF| 'becomes #'|npAssignment|)) + +@ + +\defun{npAssignment}{npAssignment} +\calls{npAssignment}{npAssignVariable} +\calls{npAssignment}{npEqKey} +\calls{npAssignment}{npTrap} +\calls{npAssignment}{npGives} +\calls{npAssignment}{npPush} +\calls{npAssignment}{pfAssign} +\calls{npAssignment}{npPop2} +\calls{npAssignment}{npPop1} +<>= +(defun |npAssignment| () + (and + (|npAssignVariable|) + (or (|npEqKey| 'becomes) (|npTrap|)) + (or (|npGives|) (|npTrap|)) + (|npPush| (|pfAssign| (|npPop2|) (|npPop1|))))) + +@ + +\defun{npAssignVariable}{npAssignVariable} +\calls{npAssignVariable}{npColon} +\calls{npAssignVariable}{npPush} +\calls{npAssignVariable}{pfListOf} +\calls{npAssignVariable}{npPop1} +<>= +(defun |npAssignVariable| () + (and (|npColon|) (|npPush| (|pfListOf| (list (|npPop1|)))))) + +@ + \defun{npListofFun}{npListofFun} \calls{npListofFun}{npTrap} \calls{npListofFun}{npPush} @@ -6857,6 +7217,18 @@ of the form ('expression expr position) @ +\defun{pfSequenceToList}{Convert a Sequence node to a list} +\calls{pfSequenceToList}{pfSequence?} +\calls{pfSequenceToList}{pfSequenceArgs} +\calls{pfSequenceToList}{pfListOf} +<>= +(defun |pfSequenceToList| (x) + (if (|pfSequence?| x) + (|pfSequenceArgs| x) + (|pfListOf| (list x)))) + +@ + \defun{pfCheckItOut}{Deconstruct nodes to lists} \calls{pfCheckItOut}{pfTagged?} \calls{pfCheckItOut}{pfTaggedExpr} @@ -7546,6 +7918,14 @@ of the form ('expression expr position) @ +\defun{pfExit}{Construct an Exit node} +\calls{pfExit}{pfTree} +<>= +(defun |pfExit| (pfcond pfexpr) + (|pfTree| '|Exit| (list pfcond pfexpr))) + +@ + \defun{pfExit?}{Is this an Exit node?} \calls{pfExit?}{pfAbSynOp?} <>= @@ -7689,8 +8069,9 @@ of the form ('expression expr position) \defun{pfHide}{Construct a Hide node} \calls{pfHide}{pfTree} <>= -(defun |pfHide| (|a| |part|) - (|pfTree| '|Hide| (list |part|))) +(defun |pfHide| (a part) + (declare (ignore a)) + (|pfTree| '|Hide| (list part))) @ @@ -8268,6 +8649,14 @@ of the form ('expression expr position) @ +\defun{pfWhere}{Construct a Where node} +\calls{pfWhere}{pfTree} +<>= +(defun |pfWhere| (pfcontext pfexpr) + (|pfTree| '|Where| (list pfcontext pfexpr))) + +@ + \defun{pfWhere?}{Is this a Where node?} \calls{pfWhere?}{pfAbSynOp?} <>= @@ -37048,35 +37437,49 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> +<> +<> +<> <> +<> <> +<> <> <> <> <> <> <> +<> <> <> <> <> <> <> +<> <> <> <> +<> +<> <> <> <> <> <> <> +<> +<> <> +<> +<> <> <> <> @@ -37086,16 +37489,20 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> <> +<> +<> <> <> <> <> +<> <> <> <> @@ -37108,6 +37515,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37115,7 +37523,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> +<> <> <> <> @@ -37129,8 +37540,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> +<> <> <> <> @@ -37208,6 +37621,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37299,6 +37713,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37329,6 +37744,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index c2dfdc7..7c87f4e 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,7 @@ +20100220 tpd src/axiom-website/patches.html 20100220.01.tpd.patch +20100220 tpd src/interp/ptrees.lisp treeshake +20100220 tpd src/interp/cparse.lisp treeshake +20100220 tpd books/bookvol5 treeshake cparse, ptrees 20100219 tpd src/axiom-website/patches.html 20100219.02.tpd.patch 20100219 tpd src/input/unittest2.input fix broken credit test 20100219 tpd books/bookvol10.4 fix broken credit test diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 1b78d74..12798b5 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2477,5 +2477,7 @@ books/bookvol5 treeshake cparse, ptrees
books/bookvol5 treeshake ptrees
20100219.02.tpd.patch books/bookvol10.4, unittest2.input fix broken credit test
+20100220.01.tpd.patch +books/bookvol5 treeshake cparse, ptrees
diff --git a/src/interp/cparse.lisp.pamphlet b/src/interp/cparse.lisp.pamphlet index d8b4b5a..db6830f 100644 --- a/src/interp/cparse.lisp.pamphlet +++ b/src/interp/cparse.lisp.pamphlet @@ -134,130 +134,6 @@ ;-- Parsing functions -;npConstTok() == -; MEMQ(tokType $stok, '(integer string char float command)) => -; npPush $stok -; npNext() -; npEqPeek "'" => -; a:=$stok -; b:=npState() -; npNext() -; if -; npPrimary1() and npPush pfSymb(npPop1(),tokPosn a) -; then true -; else -; npRestore b -; false -; false -(DEFUN |npConstTok| () - (PROG (|b| |a|) - (DECLARE (SPECIAL |$stok|)) - (RETURN - (COND - ((MEMQ - (|tokType| |$stok|) - (QUOTE (|integer| |string| |char| |float| |command|))) - (PROGN (|npPush| |$stok|) (|npNext|))) - ((|npEqPeek| (QUOTE |'|)) - (PROGN - (SETQ |a| |$stok|) - (SETQ |b| (|npState|)) - (|npNext|) - (COND - ((AND (|npPrimary1|) (|npPush| (|pfSymb| (|npPop1|) (|tokPosn| |a|)))) - T) - ((QUOTE T) - (|npRestore| |b|) NIL)))) - ((QUOTE T) - NIL))))) - -;npPrimary2()== npEncAp function npAtom2 -- or npBPileDefinition() -; or npAdd(pfNothing()) or npWith(pfNothing()) -; -(DEFUN |npPrimary2| () - (PROG NIL - (RETURN - (OR - (|npEncAp| (FUNCTION |npAtom2|)) - (|npAdd| (|pfNothing|)) - (|npWith| (|pfNothing|)))))) - -;npAtom2()== (npInfixOperator() or npAmpersand() or npPrefixColon()) -; and npFromdom() -(DEFUN |npAtom2| () - (PROG NIL - (RETURN - (AND - (OR (|npInfixOperator|) (|npAmpersand|) (|npPrefixColon|)) - (|npFromdom|))))) - -;npDollar()== npEqPeek "$" and -; npPush tokConstruct("id","$",tokPosn $stok) -; npNext() -(DEFUN |npDollar| () - (PROG NIL - (DECLARE (SPECIAL |$stok|)) - (RETURN - (AND - (|npEqPeek| (QUOTE $)) - (PROGN - (|npPush| (|tokConstruct| (QUOTE |id|) (QUOTE $) (|tokPosn| |$stok|))) - (|npNext|)))))) - -;npPrefixColon()== npEqPeek "COLON" and -; npPush tokConstruct("id",":",tokPosn $stok) -; npNext() -(DEFUN |npPrefixColon| () - (PROG NIL - (DECLARE (SPECIAL |$stok|)) - (RETURN - (AND - (|npEqPeek| (QUOTE COLON)) - (PROGN - (|npPush| (|tokConstruct| (QUOTE |id|) (QUOTE |:|) (|tokPosn| |$stok|))) - (|npNext|)))))) - -;-- silly -; -;npEncAp(f)== APPLY(f,nil) and npAnyNo function npEncl -; and npFromdom() -(DEFUN |npEncAp| (|f|) - (PROG NIL - (RETURN - (AND (APPLY |f| NIL) (|npAnyNo| (FUNCTION |npEncl|)) (|npFromdom|))))) - -; -;npEncl()== npBDefinition() and npPush pfApplication(npPop2(),npPop1()) -(DEFUN |npEncl| () - (PROG NIL - (RETURN - (AND - (|npBDefinition|) - (|npPush| (|pfApplication| (|npPop2|) (|npPop1|))))))) - -;npPrimary()== npPrimary1() or npPrimary2() -(DEFUN |npPrimary| () - (PROG NIL - (RETURN - (OR (|npPrimary1|) (|npPrimary2|))))) - -;npDotted f== APPLY(f,nil) and npAnyNo function npSelector -(DEFUN |npDotted| (|f|) - (PROG NIL - (RETURN - (AND (APPLY |f| NIL) (|npAnyNo| (FUNCTION |npSelector|)))))) - -;npSelector()== -; npEqKey "DOT" and (npPrimary() or npTrap()) and -; npPush(pfApplication(npPop2(),npPop1())) -(DEFUN |npSelector| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE DOT)) - (OR (|npPrimary|) (|npTrap|)) - (|npPush| (|pfApplication| (|npPop2|) (|npPop1|))))))) - ;npTypedForm1(sy,fn) == ; npEqKey sy and (npType() or npTrap()) and ; npPush FUNCALL(fn,npPop2(),npPop1()) @@ -412,38 +288,6 @@ (|npPush| (|pfApplication| (|npPop1|) (|npPop1|))))) T))))) -;npBy()== npLeftAssoc ('(BY),function npInterval) -(DEFUN |npBy| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (BY)) (FUNCTION |npInterval|))))) - -;npSuch() == npLeftAssoc( '(BAR),function npLogical) -(DEFUN |npSuch| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (BAR)) (FUNCTION |npLogical|))))) - -;npMatch() == npLeftAssoc ('(IS ISNT ), function npSuch) -(DEFUN |npMatch| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (IS ISNT)) (FUNCTION |npSuch|))))) - -;npADD() == npType() and -; a:=npPop1() -; npAdd(a) or npPush a -(DEFUN |npADD| () - (PROG (|a|) - (RETURN - (AND - (|npType|) - (PROGN - (SETQ |a| (|npPop1|)) - (OR - (|npAdd| |a|) - (|npPush| |a|))))))) - ;npConditionalStatement()==npConditional function npQualifiedDefinition (DEFUN |npConditionalStatement| () (PROG NIL @@ -556,29 +400,6 @@ (|npTyping|) (|npVoid|))))) -;npBackTrack(p1,p2,p3)== -; a:=npState() -; APPLY(p1,nil) => -; npEqPeek p2 => -; npRestore a -; APPLY(p3,nil) or npTrap() -; true -; false -(DEFUN |npBackTrack| (|p1| |p2| |p3|) - (PROG (|a|) - (RETURN - (PROGN - (SETQ |a| (|npState|)) - (COND - ((APPLY |p1| NIL) - (COND - ((|npEqPeek| |p2|) - (PROGN - (|npRestore| |a|) - (OR (APPLY |p3| NIL) (|npTrap|)))) - (#0=(QUOTE T) T))) - (#0# NIL)))))) - ;npMDEF()== npBackTrack(function npStatement,"MDEF",function npMDEFinition) (DEFUN |npMDEF| () (PROG NIL @@ -591,26 +412,6 @@ (RETURN (|npPP| (FUNCTION |npMdef|))))) -;npAssign()== npBackTrack(function npMDEF,"BECOMES",function npAssignment) -(DEFUN |npAssign| () - (PROG NIL - (RETURN - (|npBackTrack| (FUNCTION |npMDEF|) 'BECOMES (FUNCTION |npAssignment|))))) - -;npAssignment()== -; npAssignVariable() and -; (npEqKey "BECOMES" or npTrap()) and -; (npGives() or npTrap()) and -; npPush pfAssign (npPop2(),npPop1()) -(DEFUN |npAssignment| () - (PROG NIL - (RETURN - (AND - (|npAssignVariable|) - (OR (|npEqKey| (QUOTE BECOMES)) (|npTrap|)) - (OR (|npGives|) (|npTrap|)) - (|npPush| (|pfAssign| (|npPop2|) (|npPop1|))))))) - ;npAssignVariableName()==npApplication() and ; a:=npPop1() ; if pfId? a @@ -632,31 +433,12 @@ ((QUOTE T) (|npPush| |a|)))))))) -;npAssignVariable()== npColon() and npPush pfListOf [npPop1()] -(DEFUN |npAssignVariable| () - (PROG NIL - (RETURN - (AND (|npColon|) (|npPush| (|pfListOf| (LIST (|npPop1|)))))))) - ;npAssignVariablelist()== npListing function npAssignVariableName (DEFUN |npAssignVariablelist| () (PROG NIL (RETURN (|npListing| (FUNCTION |npAssignVariableName|))))) -;npPileExit()== -; npAssign() and (npEqKey "EXIT" or npTrap()) and -; (npStatement() or npTrap()) -; and npPush pfExit (npPop2(),npPop1()) -(DEFUN |npPileExit| () - (PROG NIL - (RETURN - (AND - (|npAssign|) - (OR (|npEqKey| (QUOTE EXIT)) (|npTrap|)) - (OR (|npStatement|) (|npTrap|)) - (|npPush| (|pfExit| (|npPop2|) (|npPop1|))))))) - ;npVoid()== npAndOr("DO",function npStatement,function pfNovalue) (DEFUN |npVoid| () (PROG NIL @@ -774,12 +556,6 @@ (|npPC| (FUNCTION |npSQualTypelist|)) (|npPush| (|pfUnSequence| (|npPop1|))))))) -;npImport()==npAndOr("IMPORT",function npQualTypelist,function pfImport) -(DEFUN |npImport| () - (PROG NIL - (RETURN - (|npAndOr| 'IMPORT (FUNCTION |npQualTypelist|) (FUNCTION |pfImport|))))) - ;npInline()==npAndOr("INLINE",function npQualTypelist,function pfInline) (DEFUN |npInline| () (PROG NIL @@ -855,12 +631,6 @@ (OR (|npLocalItemlist|) (|npTrap|)) (|npPush| (|pfExport| (|npPop1|))))))) -;npLet()== npLetQualified function npDefinitionOrStatement -(DEFUN |npLet| () - (PROG NIL - (RETURN - (|npLetQualified| (FUNCTION |npDefinitionOrStatement|))))) - ;npFix()== npEqKey "FIX" and npPP function npDef ; and npPush pfFix npPop1 () (DEFUN |npFix| () @@ -1003,23 +773,6 @@ (|npPush| (|pfWhere| (|npPop1|) (|npPop1|)))))))) T) ((QUOTE T) (|npLetQualified| |f|)))))) -;npLetQualified f== -; npEqKey "LET" and -; (npDefinition() or npTrap()) and -; npCompMissing "IN" and -; (FUNCALL f or npTrap()) and -; npPush pfWhere(npPop2(),npPop1()) -(DEFUN |npLetQualified| (|f|) - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE LET)) - (OR (|npDefinition|) (|npTrap|)) - (|npCompMissing| (QUOTE IN)) - (OR (FUNCALL |f|) (|npTrap|)) - (|npPush| (|pfWhere| (|npPop2|) (|npPop1|))))))) - -; ;npQualifiedDefinition()== ; npQualified function npDefinitionOrStatement (DEFUN |npQualifiedDefinition| () @@ -1157,51 +910,6 @@ (|npPush| (|pfMacro| |op| (|pfPushMacroBody| |arg| |body|))))))) (#0# NIL))))) -;npDefinitionItem()== -; npTyping() or -; npImport() or -; a:=npState() -; npStatement() => -; npEqPeek "DEF" => -; npRestore a -; npDef() -; npRestore a -; npMacro() or npDefn() -; npTrap() -(DEFUN |npDefinitionItem| () - (PROG (|a|) - (RETURN - (OR - (|npTyping|) - (|npImport|) - (PROGN - (SETQ |a| (|npState|)) - (COND - ((|npStatement|) - (COND - ((|npEqPeek| (QUOTE DEF)) (PROGN (|npRestore| |a|) (|npDef|))) - (#0=(QUOTE T) (PROGN (|npRestore| |a|) (OR (|npMacro|) (|npDefn|)))))) - (#0# (|npTrap|)))))))) - -;npDefinition()== npPP function npDefinitionItem -; and npPush pfSequenceToList npPop1 () -(DEFUN |npDefinition| () - (PROG NIL - (RETURN - (AND - (|npPP| (FUNCTION |npDefinitionItem|)) - (|npPush| (|pfSequenceToList| (|npPop1|))))))) - -;pfSequenceToList x== -; pfSequence? x => pfSequenceArgs x -; pfListOf [x] -(DEFUN |pfSequenceToList| (|x|) - (PROG NIL - (RETURN - (COND - ((|pfSequence?| |x|) (|pfSequenceArgs| |x|)) - ((QUOTE T) (|pfListOf| (LIST |x|))))))) - @ \eject \begin{thebibliography}{99} diff --git a/src/interp/ptrees.lisp.pamphlet b/src/interp/ptrees.lisp.pamphlet index d54a10d..14e6a7a 100644 --- a/src/interp/ptrees.lisp.pamphlet +++ b/src/interp/ptrees.lisp.pamphlet @@ -188,13 +188,6 @@ (DEFUN |pf0MLambdaArgs| (|pf|) (PROG () (RETURN (|pfParts| (|pfMLambdaArgs| |pf|))))) -;-- Where := (Context: [DeclPart], Expr: Expr) - -;pfWhere(pfcontext, pfexpr) == pfTree('Where, [pfcontext, pfexpr]) - -(DEFUN |pfWhere| (|pfcontext| |pfexpr|) - (PROG () (RETURN (|pfTree| '|Where| (LIST |pfcontext| |pfexpr|))))) - ;-- Loop := (Iterators: [Iterator]) ;pfLoop(pfiterators) == pfTree('Loop, [pfiterators]) @@ -259,13 +252,6 @@ (DEFUN |pfReturn| (|pfexpr| |pffrom|) (PROG () (RETURN (|pfTree| '|Return| (LIST |pfexpr| |pffrom|))))) -;-- Exit := (Cond: ? Expr, Expr: ? Expr) - -;pfExit(pfcond, pfexpr) == pfTree('Exit, [pfcond, pfexpr]) - -(DEFUN |pfExit| (|pfcond| |pfexpr|) - (PROG () (RETURN (|pfTree| '|Exit| (LIST |pfcond| |pfexpr|))))) - ;-- Macro := (Lhs: Id, Rhs: ExprorNot) ;pfMacro(pflhs, pfrhs) == pfTree('Macro, [pflhs, pfrhs])