diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 04c08f6..032bc76 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -5632,6 +5632,319 @@ and the current token (\$ttok) @ +\defun{npApplication}{npApplication} +\calls{npApplication}{npDotted} +\calls{npApplication}{npPrimary} +\calls{npApplication}{npApplication2} +\calls{npApplication}{npPush} +\calls{npApplication}{pfApplication} +\calls{npApplication}{npPop2} +\calls{npApplication}{npPop1} +<>= +(defun |npApplication| () + (and + (|npDotted| #'|npPrimary|) + (or + (and + (|npApplication2|) + (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) + t))) + +@ + +\defun{npApplication2}{npApplication2} +\calls{npApplication2}{npDotted} +\calls{npApplication2}{npPrimary1} +\calls{npApplication2}{npApplication2} +\calls{npApplication2}{npPush} +\calls{npApplication2}{pfApplication} +\calls{npApplication2}{npPop2} +\calls{npApplication2}{npPop1} +<>= +(defun |npApplication2| () + (and + (|npDotted| #'|npPrimary1|) + (or + (and + (|npApplication2|) + (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) + t))) + +@ + +\defun{npPrimary1}{npPrimary1} +\calls{npPrimary1}{npEncAp} +\calls{npPrimary1}{npAtom1} +\calls{npPrimary1}{npLet} +\calls{npPrimary1}{npFix} +\calls{npPrimary1}{npMacro} +\calls{npPrimary1}{npBPileDefinition} +\calls{npPrimary1}{npDefn} +\calls{npPrimary1}{npRule} +<>= +(defun |npPrimary1| () + (or + (|npEncAp| #'|npAtom1|) + (|npLet|) + (|npFix|) + (|npMacro|) + (|npBPileDefinition|) + (|npDefn|) + (|npRule|))) + +@ + +\defun{npBPileDefinition}{npBPileDefinition} +\calls{npBPileDefinition}{npPileBracketed} +\calls{npBPileDefinition}{npPileDefinitionlist} +\calls{npBPileDefinition}{npPush} +\calls{npBPileDefinition}{pfSequence} +\calls{npBPileDefinition}{pfListOf} +\calls{npBPileDefinition}{npPop1} +<>= +(defun |npBPileDefinition| () + (and + (|npPileBracketed| #'|npPileDefinitionlist|) + (|npPush| (|pfSequence| (|pfListOf| (|npPop1|)))))) + +@ + +\defun{npPileDefinitionlist}{npPileDefinitionlist} +\calls{npPileDefinitionlist}{npListAndRecover} +\calls{npPileDefinitionlist}{npDefinitionlist} +\calls{npPileDefinitionlist}{npPush} +\calls{npPileDefinitionlist}{pfAppend} +\calls{npPileDefinitionlist}{npPop1} +<>= +(defun |npPileDefinitionlist| () + (and + (|npListAndRecover| #'|npDefinitionlist|) + (|npPush| (|pfAppend| (|npPop1|))))) + +@ + +\defun{npListAndRecover}{npListAndRecover} +\catches{npListAndRecover}{trappoint} +\calls{npListAndRecover}{npRecoverTrap} +\calls{npListAndRecover}{syGeneralErrorHere} +\calls{npListAndRecover}{npEqKey} +\calls{npListAndRecover}{npEqPeek} +\calls{npListAndRecover}{npNext} +\calls{npListAndRecover}{npPop1} +\calls{npListAndRecover}{npPush} +\usesdollar{npListAndRecover}{inputStream} +\usesdollar{npListAndRecover}{stack} +<>= +(defun |npListAndRecover| (f) + (let (found c done b savestack) + (declare (special |$inputStream| |$stack|)) + (setq savestack |$stack|) + (setq |$stack| nil) + (setq c |$inputStream|) + (do () + (done) + (setq found (catch 'trappoint (apply f nil))) + (cond + ((eq found 'trapped) + (setq |$inputStream| c) + (|npRecoverTrap|)) + ((null found) + (setq |$inputStream| c) + (|syGeneralErrorHere|) (|npRecoverTrap|))) + (cond + ((|npEqKey| 'backset) (setq c |$inputStream|)) + ((|npEqPeek| 'backtab) (setq done t)) + (t + (setq |$inputStream| c) + (|syGeneralErrorHere|) + (|npRecoverTrap|) + (cond + ((|npEqPeek| 'backtab) (setq done t)) + (t + (|npNext|) + (setq c |$inputStream|))))) + (setq b (cons (|npPop1|) b))) + (setq |$stack| savestack) + (|npPush| (nreverse b)))) + +@ + +\defun{npRecoverTrap}{npRecoverTrap} +\calls{npRecoverTrap}{npFirstTok} +\calls{npRecoverTrap}{tokPosn} +\calls{npRecoverTrap}{npMoveTo} +\calls{npRecoverTrap}{syIgnoredFromTo} +\calls{npRecoverTrap}{npPush} +\calls{npRecoverTrap}{pfWrong} +\calls{npRecoverTrap}{pfDocument} +\calls{npRecoverTrap}{pfListOf} +\usesdollar{npRecoverTrap}{stok} +<>= +(defun |npRecoverTrap| () + (let (pos2 pos1) + (declare (special |$stok|)) + (|npFirstTok|) + (setq pos1 (|tokPosn| |$stok|)) + (|npMoveTo| 0) + (setq pos2 (|tokPosn| |$stok|)) + (|syIgnoredFromTo| pos1 pos2) + (|npPush| + (list (|pfWrong| (|pfDocument| (list "pile syntax error")) + (|pfListOf| nil)))))) + +@ + +\defun{npMoveTo}{npMoveTo} +\calls{npMoveTo}{npEqPeek} +\calls{npMoveTo}{npNext} +\calls{npMoveTo}{npMoveTo} +\calls{npMoveTo}{npEqKey} +\usesdollar{npMoveTo}{inputStream} +<>= +(defun |npMoveTo| (|n|) + (declare (special |$inputStream|)) + (cond + ((null |$inputStream|) t) + ((|npEqPeek| 'backtab) + (cond + ((eql |n| 0) t) + (t (|npNext|) (|npMoveTo| (1- |n|))))) + ((|npEqPeek| 'backset) + (cond + ((eql |n| 0) t) + (t (|npNext|) (|npMoveTo| |n|)))) + ((|npEqKey| 'settab) (|npMoveTo| (+ |n| 1))) + (t (|npNext|) (|npMoveTo| |n|)))) + +@ + +\defun{syIgnoredFromTo}{syIgnoredFromTo} +\calls{syIgnoredFromTo}{pfGlobalLinePosn} +\calls{syIgnoredFromTo}{ncSoftError} +\calls{syIgnoredFromTo}{FromTo} +\calls{syIgnoredFromTo}{From} +\calls{syIgnoredFromTo}{To} +<>= +(defun |syIgnoredFromTo| (pos1 pos2) + (cond + ((equal (|pfGlobalLinePosn| pos1) (|pfGlobalLinePosn| pos2)) + (|ncSoftError| (|FromTo| pos1 pos2) 'S2CY0005 nil)) + (t + (|ncSoftError| (|From| pos1) 'S2CY0003 nil) + (|ncSoftError| (|To| pos2) 'S2CY0004 nil)))) + +@ + +\defun{syGeneralErrorHere}{syGeneralErrorHere} +\calls{syGeneralErrorHere}{sySpecificErrorHere} +<>= +(defun |syGeneralErrorHere| () + (|sySpecificErrorHere| 'S2CY0002 nil)) + +@ + +\defun{sySpecificErrorHere}{sySpecificErrorHere} +\calls{sySpecificErrorHere}{sySpecificErrorAtToken} +\usesdollar{sySpecificErrorHere}{stok} +<>= +(defun |sySpecificErrorHere| (key args) + (declare (special |$stok|)) + (|sySpecificErrorAtToken| |$stok| key args)) + +@ + +\defun{sySpecificErrorAtToken}{sySpecificErrorAtToken} +\calls{sySpecificErrorAtToken}{ncSoftError} +\calls{sySpecificErrorAtToken}{tokPosn} +<>= +(defun |sySpecificErrorAtToken| (tok key args) + (|ncSoftError| (|tokPosn| tok) key args)) + +@ + +\defun{npDefinitionlist}{npDefinitionlist} +\calls{npDefinitionlist}{npSemiListing} +\calls{npDefinitionlist}{npQualDef} +<>= +(defun |npDefinitionlist| () + (|npSemiListing| #'|npQualDef|)) + +@ + +\defun{npSemiListing}{npSemiListing} +\calls{npSemiListing}{npListofFun} +\calls{npSemiListing}{npSemiBackSet} +\calls{npSemiListing}{pfAppend} +<>= +(defun |npSemiListing| (p) + (|npListofFun| p #'|npSemiBackSet| #'|pfAppend|)) + +@ + +\defun{npSemiBackSet}{npSemiBackSet} +\calls{npSemiBackSet}{npEqKey} +<>= +(defun |npSemiBackSet| () + (and (|npEqKey| 'semicolon) (or (|npEqKey| 'backset) t))) + +@ + +\defun{npRule}{npRule} +\calls{npRule}{npEqKey} +\calls{npRule}{npPP} +\calls{npRule}{npSingleRule} +<>= +(defun |npRule| () + (and + (|npEqKey| 'rule) + (|npPP| #'|npSingleRule|))) + +@ + +\defun{npSingleRule}{npSingleRule} +\calls{npSingleRule}{npQuiver} +\calls{npSingleRule}{npDefTail} +\calls{npSingleRule}{npTrap} +\calls{npSingleRule}{npPush} +\calls{npSingleRule}{pfRule} +\calls{npSingleRule}{npPop2} +\calls{npSingleRule}{npPop1} +<>= +(defun |npSingleRule| () + (when (|npQuiver|) + (or (|npDefTail|) (|npTrap|)) + (|npPush| (|pfRule| (|npPop2|) (|npPop1|))))) + +@ + +\defun{npDefTail}{npDefTail} +\calls{npDefTail}{npEqKey} +\calls{npDefTail}{npDefinitionOrStatement} +<>= +(defun |npDefTail| () + (and + (or (|npEqKey| 'def) (|npEqKey| 'mdef)) + (|npDefinitionOrStatement|))) + +@ + +\defun{npDefaultValue}{npDefaultValue} +\calls{npDefaultValue}{npEqKey} +\calls{npDefaultValue}{npDefinitionOrStatement} +\calls{npDefaultValue}{npTrap} +\calls{npDefaultValue}{npPush} +\calls{npDefaultValue}{pfAdd} +\calls{npDefaultValue}{pfNothing} +\calls{npDefaultValue}{npPop1} +<>= +(defun |npDefaultValue| () + (and + (|npEqKey| 'default) + (or (|npDefinitionOrStatement|) (|npTrap|)) + (|npPush| (list (|pfAdd| (|pfNothing|) (|npPop1|) (|pfNothing|)))))) + +@ + \defun{npWConditional}{npWConditional} \calls{npWConditional}{npConditional} \calls{npWConditional}{npPush} @@ -6145,6 +6458,16 @@ argument of the form ('expression expr position) \end{itemize} +\section{Structure handlers} + +\defun{pfGlobalLinePosn}{pfGlobalLinePosn} +\calls{pfGlobalLinePosn}{poGlobalLinePosn} +<>= +(defun |pfGlobalLinePosn| (posn) + (|poGlobalLinePosn| posn)) + +@ + \section{Special Nodes} \defun{pfListOf}{Create a Listof node} @@ -35976,8 +36299,11 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> <> +<> <> <> <> @@ -35985,7 +36311,10 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> +<> <> <> <> @@ -36001,12 +36330,15 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> +<> <> <> <> +<> <> <> <> @@ -36014,15 +36346,21 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> <> +<> <> <> +<> <> +<> +<> +<> <> <> <> @@ -36100,6 +36438,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -36466,9 +36805,13 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> <> <> <> +<> +<> <> <> diff --git a/changelog b/changelog index 3b23599..ea19692 100644 --- a/changelog +++ b/changelog @@ -1,3 +1,8 @@ +20100216 tpd src/axiom-website/patches.html 20100216.03.tpd.patch +20100216 tpd src/interp/serror.lisp treeshake +20100216 tpd src/interp/posit.lisp treeshake +20100216 tpd src/interp/cparse.lisp treeshake +20100216 tpd books/bookvol5 treeshake cparse posit serror 20100216 tpd src/axiom-website/patches.html 20100216.02.jpf.patch 20100216 jpf books/bookvol10.1 add Clifford chapter 20100216 jpf books/bookvol5 add John Fletcher to credits diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 169650b..7488d66 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2463,5 +2463,7 @@ books/bookvol5 treeshake cparse, ptrees, ptrop vmlisp
books/bookvol5 add )set break quit
20100216.02.jpf.patch books/bookvol10.1 add Clifford chapter, per John Fletcher
+20100216.03.tpd.patch +books/bookvol5 treeshake cparse posit serror
diff --git a/src/interp/cparse.lisp.pamphlet b/src/interp/cparse.lisp.pamphlet index d448dfc..4d2d60a 100644 --- a/src/interp/cparse.lisp.pamphlet +++ b/src/interp/cparse.lisp.pamphlet @@ -385,26 +385,6 @@ ((QUOTE T) NIL))))) -; -;npPrimary1() == -; npEncAp function npAtom1 or -; npLet() or -; npFix() or -; npMacro() or -; npBPileDefinition() or npDefn() or -; npRule() -(DEFUN |npPrimary1| () - (PROG NIL - (RETURN - (OR - (|npEncAp| (FUNCTION |npAtom1|)) - (|npLet|) - (|npFix|) - (|npMacro|) - (|npBPileDefinition|) - (|npDefn|) - (|npRule|))))) - ;npPrimary2()== npEncAp function npAtom2 -- or npBPileDefinition() ; or npAdd(pfNothing()) or npWith(pfNothing()) ; @@ -534,37 +514,6 @@ (OR (|npPrimary|) (|npTrap|)) (|npPush| (|pfApplication| (|npPop2|) (|npPop1|))))))) -;npApplication()== -; npDotted function npPrimary and -; (npApplication2() and -; npPush(pfApplication(npPop2(),npPop1())) or true) -(DEFUN |npApplication| () - (PROG NIL - (RETURN - (AND - (|npDotted| (FUNCTION |npPrimary|)) - (OR - (AND - (|npApplication2|) - (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) - T))))) - -; -;npApplication2()== -; npDotted function npPrimary1 and -; (npApplication2() and -; npPush(pfApplication(npPop2(),npPop1())) or true) -(DEFUN |npApplication2| () - (PROG NIL - (RETURN - (AND - (|npDotted| (FUNCTION |npPrimary1|)) - (OR - (AND - (|npApplication2|) - (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) - T))))) - ;npTypedForm1(sy,fn) == ; npEqKey sy and (npType() or npTrap()) and ; npPush FUNCALL(fn,npPop2(),npPop1()) @@ -1247,14 +1196,6 @@ (|npEqKey| (QUOTE MACRO)) (|npPP| (FUNCTION |npMdef|)))))) -;npRule()== npEqKey "RULE" and npPP function npSingleRule -(DEFUN |npRule| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE RULE)) - (|npPP| (FUNCTION |npSingleRule|)))))) - ;npAdd(extra)== ; npEqKey "ADD" and ; a:=npState() @@ -1286,18 +1227,6 @@ ((QUOTE T) (|npPush| (|pfAdd| (|pfNothing|) (|npPop1|) |extra|))))))))) -;npDefaultValue()== -; npEqKey "DEFAULT" and -; (npDefinitionOrStatement() or npTrap()) -; and npPush [pfAdd(pfNothing(),npPop1(),pfNothing())] -(DEFUN |npDefaultValue| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE DEFAULT)) - (OR (|npDefinitionOrStatement|) (|npTrap|)) - (|npPush| (LIST (|pfAdd| (|pfNothing|) (|npPop1|) (|pfNothing|)))))))) - ;npSignatureDefinee()== ; npName() or npInfixOperator() or npPrefixColon() (DEFUN |npSignatureDefinee| () @@ -1339,19 +1268,6 @@ (RETURN (AND (|npSigItemlist|) (|npPush| (|pfWDec| (|pfNothing|) (|npPop1|))))))) -;npSemiListing (p)== -; npListofFun(p,function npSemiBackSet,function pfAppend) -(DEFUN |npSemiListing| (|p|) - (PROG NIL - (RETURN - (|npListofFun| |p| (FUNCTION |npSemiBackSet|) (FUNCTION |pfAppend|))))) - -;npSemiBackSet()== npEqKey "SEMICOLON" and (npEqKey "BACKSET" or true) -(DEFUN |npSemiBackSet| () - (PROG NIL - (RETURN - (AND (|npEqKey| (QUOTE SEMICOLON)) (OR (|npEqKey| (QUOTE BACKSET)) T))))) - ;npDecl()== npEqKey "COLON" and (npType() or npTrap()) and ; npPush pfTyped (npPop2(),npPop1()) (DEFUN |npDecl| () @@ -1451,12 +1367,6 @@ (|npComma|) (|npPush| (LIST (|npPop1|))))))) -;npDefinitionlist ()==npSemiListing(function npQualDef) -(DEFUN |npDefinitionlist| () - (PROG NIL - (RETURN - (|npSemiListing| (FUNCTION |npQualDef|))))) - ;npPDefinition ()== ; npParenthesized function npDefinitionlist and ; npPush pfEnSequence npPop1() @@ -1476,17 +1386,6 @@ (|npPDefinition|) (|npBracketed| (FUNCTION |npDefinitionlist|)))))) -;npPileDefinitionlist()== -; npListAndRecover function npDefinitionlist -; and npPush pfAppend npPop1() -(DEFUN |npPileDefinitionlist| () - (PROG NIL - (RETURN - (AND - (|npListAndRecover| (FUNCTION |npDefinitionlist|)) - (|npPush| (|pfAppend| (|npPop1|))))))) - -; ;npTypeVariable()== npParenthesized function npTypeVariablelist or ; npSignatureDefinee() and npPush pfListOf [npPop1()] (DEFUN |npTypeVariable| () @@ -1549,16 +1448,6 @@ (|npListing| (FUNCTION |npDefaultItem|)) (|npPush| (|pfAppend| (|pfParts| (|npPop1|)))))))) -;npBPileDefinition()== -; npPileBracketed function npPileDefinitionlist -; and npPush pfSequence pfListOf npPop1 () -(DEFUN |npBPileDefinition| () - (PROG NIL - (RETURN - (AND - (|npPileBracketed| (FUNCTION |npPileDefinitionlist|)) - (|npPush| (|pfSequence| (|pfListOf| (|npPop1|)))))))) - ;npDef()== ; npMatch() => ; [op,arg,rt]:= pfCheckItOut(npPop1()) @@ -1586,15 +1475,6 @@ (|npPush| (|pfDefinition| |op| (|pfPushBody| |rt| |arg| |body|))))))) (#1# NIL))))) -;--npDefTail()== npEqKey "DEF" and npDefinitionOrStatement() -;npDefTail()== (npEqKey "DEF" or npEqKey "MDEF") and npDefinitionOrStatement() -(DEFUN |npDefTail| () - (PROG NIL - (RETURN - (AND - (OR (|npEqKey| (QUOTE DEF)) (|npEqKey| (QUOTE MDEF))) - (|npDefinitionOrStatement|))))) - ;npMdef()== ; npQuiver() => ; [op,arg]:= pfCheckMacroOut(npPop1()) @@ -1621,22 +1501,6 @@ (|npPush| (|pfMacro| |op| (|pfPushMacroBody| |arg| |body|))))))) (#0# NIL))))) -; -;npSingleRule()== -; npQuiver() => -; npDefTail() or npTrap() -; npPush pfRule (npPop2(),npPop1()) -; false -(DEFUN |npSingleRule| () - (PROG NIL - (RETURN - (COND - ((|npQuiver|) - (PROGN - (OR (|npDefTail|) (|npTrap|)) - (|npPush| (|pfRule| (|npPop2|) (|npPop1|))))) - ((QUOTE T) NIL))))) - ;npDefinitionItem()== ; npTyping() or ; npImport() or diff --git a/src/interp/posit.lisp.pamphlet b/src/interp/posit.lisp.pamphlet index 45fc8f4..e39d839 100644 --- a/src/interp/posit.lisp.pamphlet +++ b/src/interp/posit.lisp.pamphlet @@ -138,11 +138,6 @@ (DEFUN |pfLinePosn| (|posn|) (PROG () (RETURN (|poLinePosn| |posn|)))) -;pfGlobalLinePosn posn == poGlobalLinePosn posn - -(DEFUN |pfGlobalLinePosn| (|posn|) - (PROG () (RETURN (|poGlobalLinePosn| |posn|)))) - ;pfFileName posn == poFileName posn (DEFUN |pfFileName| (|posn|) (PROG () (RETURN (|poFileName| |posn|)))) diff --git a/src/interp/serror.lisp.pamphlet b/src/interp/serror.lisp.pamphlet index 0c61000..9caf734 100644 --- a/src/interp/serror.lisp.pamphlet +++ b/src/interp/serror.lisp.pamphlet @@ -15,48 +15,6 @@ ;--% Functions to handle specific errors (mostly syntax) -;syGeneralErrorHere() == -; sySpecificErrorHere('S2CY0002, []) - -(DEFUN |syGeneralErrorHere| () - (PROG () (RETURN (|sySpecificErrorHere| 'S2CY0002 NIL)))) - -;sySpecificErrorHere(key, args) == -; sySpecificErrorAtToken($stok, key, args) - -(DEFUN |sySpecificErrorHere| (|key| |args|) - (PROG () - (DECLARE (SPECIAL |$stok|)) - (RETURN (|sySpecificErrorAtToken| |$stok| |key| |args|)))) - -;sySpecificErrorAtToken(tok, key, args) == -; pos := tokPosn tok -; ncSoftError(pos, key, args) - -(DEFUN |sySpecificErrorAtToken| (|tok| |key| |args|) - (PROG (|pos|) - (RETURN - (PROGN - (SETQ |pos| (|tokPosn| |tok|)) - (|ncSoftError| |pos| |key| |args|))))) - -;syIgnoredFromTo(pos1, pos2) == -; if pfGlobalLinePosn pos1 = pfGlobalLinePosn pos2 then -; ncSoftError(FromTo(pos1,pos2), 'S2CY0005, []) -; else -; ncSoftError(From pos1, 'S2CY0003, []) -; ncSoftError(To pos2, 'S2CY0004, []) - -(DEFUN |syIgnoredFromTo| (|pos1| |pos2|) - (PROG () - (RETURN - (COND - ((EQUAL (|pfGlobalLinePosn| |pos1|) - (|pfGlobalLinePosn| |pos2|)) - (|ncSoftError| (|FromTo| |pos1| |pos2|) 'S2CY0005 NIL)) - ('T (|ncSoftError| (|From| |pos1|) 'S2CY0003 NIL) - (|ncSoftError| (|To| |pos2|) 'S2CY0004 NIL)))))) - ;npMissingMate(close,open)== ; ncSoftError(tokPosn open, 'S2CY0008, []) ; npMissing close @@ -109,127 +67,6 @@ (|ncSoftError| (|tokPosn| |a|) 'S2CY0002 NIL) (THROW 'TRAPPOINT 'TRAPPED)))))))) -;npRecoverTrap()== -; npFirstTok() -; pos1 := tokPosn $stok -; npMoveTo 0 -; pos2 := tokPosn $stok -; syIgnoredFromTo(pos1, pos2) -; npPush [pfWrong(pfDocument ['"pile syntax error"],pfListOf [])] - -(DEFUN |npRecoverTrap| () - (PROG (|pos2| |pos1|) - (DECLARE (SPECIAL |$stok|)) - (RETURN - (PROGN - (|npFirstTok|) - (SETQ |pos1| (|tokPosn| |$stok|)) - (|npMoveTo| 0) - (SETQ |pos2| (|tokPosn| |$stok|)) - (|syIgnoredFromTo| |pos1| |pos2|) - (|npPush| - (LIST (|pfWrong| (|pfDocument| (LIST "pile syntax error")) - (|pfListOf| NIL)))))))) - -;npListAndRecover(f)== -; a:=$stack -; b:=nil -; $stack:=nil -; done:=false -; c:=$inputStream -; while not done repeat -; found:=CATCH("TRAPPOINT",APPLY(f,nil)) -; if found="TRAPPED" -; then -; $inputStream:=c -; npRecoverTrap() -; else if not found -; then -; $inputStream:=c -; syGeneralErrorHere() -; npRecoverTrap() -; if npEqKey "BACKSET" -; then -; c:=$inputStream -; else if npEqPeek "BACKTAB" -; then -; done:=true -; else -; $inputStream:=c -; syGeneralErrorHere() -; npRecoverTrap() -; if npEqPeek "BACKTAB" -; then done:=true -; else -; npNext() -; c:=$inputStream -; b:=cons(npPop1(),b) -; $stack:=a -; npPush NREVERSE b - -(DEFUN |npListAndRecover| (|f|) - (PROG (|found| |c| |done| |b| |a|) - (DECLARE (SPECIAL |$inputStream| |$stack|)) - (RETURN - (PROGN - (SETQ |a| |$stack|) - (SETQ |b| NIL) - (SETQ |$stack| NIL) - (SETQ |done| NIL) - (SETQ |c| |$inputStream|) - ((LAMBDA () - (LOOP - (COND - (|done| (RETURN NIL)) - ('T - (PROGN - (SETQ |found| (CATCH 'TRAPPOINT (APPLY |f| NIL))) - (COND - ((EQ |found| 'TRAPPED) (SETQ |$inputStream| |c|) - (|npRecoverTrap|)) - ((NULL |found|) (SETQ |$inputStream| |c|) - (|syGeneralErrorHere|) (|npRecoverTrap|))) - (COND - ((|npEqKey| 'BACKSET) (SETQ |c| |$inputStream|)) - ((|npEqPeek| 'BACKTAB) (SETQ |done| T)) - ('T (SETQ |$inputStream| |c|) - (|syGeneralErrorHere|) (|npRecoverTrap|) - (COND - ((|npEqPeek| 'BACKTAB) (SETQ |done| T)) - ('T (|npNext|) (SETQ |c| |$inputStream|))))) - (SETQ |b| (CONS (|npPop1|) |b|)))))))) - (SETQ |$stack| |a|) - (|npPush| (NREVERSE |b|)))))) - -;npMoveTo n== -; if null $inputStream -; then true -; else -; if npEqPeek "BACKTAB" -; then if n=0 -; then true -; else (npNext();npMoveTo(n-1)) -; else if npEqPeek "BACKSET" -; then if n=0 -; then true -; else (npNext();npMoveTo n) -; else if npEqKey "SETTAB" -; then npMoveTo(n+1) -; else (npNext();npMoveTo n) - -(DEFUN |npMoveTo| (|n|) - (PROG () - (DECLARE (SPECIAL |$inputStream|)) - (RETURN - (COND - ((NULL |$inputStream|) T) - ((|npEqPeek| 'BACKTAB) - (COND ((EQL |n| 0) T) ('T (|npNext|) (|npMoveTo| (- |n| 1))))) - ((|npEqPeek| 'BACKSET) - (COND ((EQL |n| 0) T) ('T (|npNext|) (|npMoveTo| |n|)))) - ((|npEqKey| 'SETTAB) (|npMoveTo| (+ |n| 1))) - ('T (|npNext|) (|npMoveTo| |n|)))))) - @ \eject \begin{thebibliography}{99}