diff --git a/books/bookvol5.pamphlet b/books/bookvol5.pamphlet index 92b5129..12de8af 100644 --- a/books/bookvol5.pamphlet +++ b/books/bookvol5.pamphlet @@ -5427,6 +5427,26 @@ and the current token (\$ttok) @ +\defun{npQualified}{npQualified} +\calls{npQualified}{npEqKey} +\calls{npQualified}{npDefinition} +\calls{npQualified}{npTrap} +\calls{npQualified}{npPush} +\calls{npQualified}{pfWhere} +\calls{npQualified}{npPop1} +\calls{npQualified}{npLetQualified} +<>= +(defun |npQualified| (f) + (if (funcall f) + (progn + (do () ; while ... do + ((not (and (|npEqKey| 'where) (or (|npDefinition|) (|npTrap|))))) + (|npPush| (|pfWhere| (|npPop1|) (|npPop1|)))) + t) + (|npLetQualified| f))) + +@ + \defun{npDefinitionOrStatement}{npDefinitionOrStatement} \calls{npDefinitionOrStatement}{npBackTrack} \calls{npDefinitionOrStatement}{npGives} @@ -5748,6 +5768,40 @@ and the current token (\$ttok) @ +\defun{npTypeVariable}{npTypeVariable} +\calls{npTypeVariable}{npParenthesized} +\calls{npTypeVariable}{npTypeVariablelist} +\calls{npTypeVariable}{npSignatureDefinee} +\calls{npTypeVariable}{npPush} +\calls{npTypeVariable}{pfListOf} +\calls{npTypeVariable}{npPop1} +<>= +(defun |npTypeVariable| () + (or + (|npParenthesized| #'|npTypeVariablelist|) + (and (|npSignatureDefinee|) (|npPush| (|pfListOf| (list (|npPop1|))))))) + +@ + +\defun{npSignatureDefinee}{npSignatureDefinee} +\calls{npSignatureDefinee}{npName} +\calls{npSignatureDefinee}{npInfixOperator} +\calls{npSignatureDefinee}{npPrefixColon} +<>= +(defun |npSignatureDefinee| () + (or (|npName|) (|npInfixOperator|) (|npPrefixColon|))) + +@ + +\defun{npTypeVariablelist}{npTypeVariablelist} +\calls{npTypeVariablelist}{npListing} +\calls{npTypeVariablelist}{npSignatureDefinee} +<>= +(defun |npTypeVariablelist| () + (|npListing| #'|npSignatureDefinee|)) + +@ + \defun{npSigDecl}{npSigDecl} \calls{npSigDecl}{npEqKey} \calls{npSigDecl}{npType} @@ -6035,6 +6089,52 @@ fn must transform the head of the stack @ +\defun{npMdef}{npMdef} +\tpdhere{Beware that this function occurs with uppercase also} +\calls{npMdef}{npQuiver} +\calls{npMdef}{pfCheckMacroOut} +\calls{npMdef}{npPop1} +\calls{npMdef}{npDefTail} +\calls{npMdef}{npTrap} +\calls{npMdef}{npPop1} +\calls{npMdef}{npPush} +\calls{npMdef}{pfMacro} +\calls{npMdef}{pfPushMacroBody} +<>= +(defun |npMdef| () + (let (body arg op tmp) + (when (|npQuiver|) ;[op,arg]:= pfCheckMacroOut(npPop1()) + (setq tmp (|pfCheckMacroOut| (|npPop1|))) + (setq op (car tmp)) + (setq arg (cadr tmp)) + (or (|npDefTail|) (|npTrap|)) + (setq body (|npPop1|)) + (if (null arg) + (|npPush| (|pfMacro| op body)) + (|npPush| (|pfMacro| op (|pfPushMacroBody| arg body))))))) + +@ + +\defun{npMDEF}{npMDEF} +\tpdhere{Beware that this function occurs with lowercase also} +\calls{npMDEF}{npBackTrack} +\calls{npMDEF}{npStatement} +\calls{npMDEF}{npMDEFinition} +<>= +(defun |npMDEF| () + (|npBackTrack| #'|npStatement| 'mdef #'|npMDEFinition|)) + +@ + +\defun{npMDEFinition}{npMDEFinition} +\calls{npMDEFinition}{npPP} +\calls{npMDEFinition}{npMdef} +<>= +(defun |npMDEFinition| () + (|npPP| #'|npMdef|)) + +@ + \defun{npFix}{npFix} \calls{npFix}{npEqKey} \calls{npFix}{npDef} @@ -6124,6 +6224,81 @@ fn must transform the head of the stack @ +\defun{npTyping}{npTyping} +\calls{npTyping}{npEqKey} +\calls{npTyping}{npDefaultItemlist} +\calls{npTyping}{npTrap} +\calls{npTyping}{npPush} +\calls{npTyping}{pfTyping} +\calls{npTyping}{npPop1} +<>= +(defun |npTyping| () + (and + (|npEqKey| 'default) + (or (|npDefaultItemlist|) (|npTrap|)) + (|npPush| (|pfTyping| (|npPop1|))))) + +@ + +\defun{npDefaultItemlist}{npDefaultItemlist} +\calls{npDefaultItemlist}{npPC} +\calls{npDefaultItemlist}{npSDefaultItem} +\calls{npDefaultItemlist}{npPush} +\calls{npDefaultItemlist}{pfUnSequence} +\calls{npDefaultItemlist}{npPop1} +<>= +(defun |npDefaultItemlist| () + (and + (|npPC| #'|npSDefaultItem|) + (|npPush| (|pfUnSequence| (|npPop1|))))) + +@ + +\defun{npSDefaultItem}{npSDefaultItem} +\calls{npSDefaultItem}{npListing} +\calls{npSDefaultItem}{npDefaultItem} +\calls{npSDefaultItem}{npPush} +\calls{npSDefaultItem}{pfAppend} +\calls{npSDefaultItem}{pfParts} +\calls{npSDefaultItem}{npPop1} +<>= +(defun |npSDefaultItem| () + (and + (|npListing| #'|npDefaultItem|) + (|npPush| (|pfAppend| (|pfParts| (|npPop1|)))))) + +@ + +\defun{npDefaultItem}{npDefaultItem} +\calls{npDefaultItem}{npTypeVariable} +\calls{npDefaultItem}{npDefaultDecl} +\calls{npDefaultItem}{npTrap} +<>= +(defun |npDefaultItem| () + (and + (|npTypeVariable|) + (or (|npDefaultDecl|) (|npTrap|)))) + +@ + +\defun{npDefaultDecl}{npDefaultDecl} +\calls{npDefaultDecl}{npEqKey} +\calls{npDefaultDecl}{npType} +\calls{npDefaultDecl}{npTrap} +\calls{npDefaultDecl}{npPush} +\calls{npDefaultDecl}{pfSpread} +\calls{npDefaultDecl}{pfParts} +\calls{npDefaultDecl}{npPop2} +\calls{npDefaultDecl}{npPop1} +<>= +(defun |npDefaultDecl| () + (and + (|npEqKey| 'colon) + (or (|npType|) (|npTrap|)) + (|npPush| (|pfSpread| (|pfParts| (|npPop2|)) (|npPop1|))))) + +@ + \defun{npStatement}{npStatement} \calls{npStatement}{npExpress} \calls{npStatement}{npLoop} @@ -6155,6 +6330,347 @@ fn must transform the head of the stack @ +\defun{npExport}{npExport} +\calls{npExport}{npEqKey} +\calls{npExport}{npLocalItemlist} +\calls{npExport}{npTrap} +\calls{npExport}{npPush} +\calls{npExport}{pfExport} +\calls{npExport}{npPop1} +<>= +(defun |npExport| () + (and + (|npEqKey| 'export) + (or (|npLocalItemlist|) (|npTrap|)) + (|npPush| (|pfExport| (|npPop1|))))) + +@ + +\defun{npLocalItemlist}{npLocalItemlist} +\calls{npLocalItemlist}{npPC} +\calls{npLocalItemlist}{npSLocalItem} +\calls{npLocalItemlist}{npPush} +\calls{npLocalItemlist}{pfUnSequence} +\calls{npLocalItemlist}{npPop1} +<>= +(defun |npLocalItemlist| () + (and + (|npPC| #'|npSLocalItem|) + (|npPush| (|pfUnSequence| (|npPop1|))))) + +@ + +\defun{npSLocalItem}{npSLocalItem} +\calls{npSLocalItem}{npListing} +\calls{npSLocalItem}{npLocalItem} +\calls{npSLocalItem}{npPush} +\calls{npSLocalItem}{pfAppend} +\calls{npSLocalItem}{pfParts} +\calls{npSLocalItem}{npPop1} +<>= +(defun |npSLocalItem| () + (and + (|npListing| #'|npLocalItem|) + (|npPush| (|pfAppend| (|pfParts| (|npPop1|)))))) + +@ + +\defun{npLocalItem}{npLocalItem} +\calls{npLocalItem}{npTypeVariable} +\calls{npLocalItem}{npLocalDecl} +<>= +(defun |npLocalItem| () + (and + (|npTypeVariable|) + (|npLocalDecl|))))) + +@ + +\defun{npLocalDecl}{npLocalDecl} +\calls{npLocalDecl}{npEqKey} +\calls{npLocalDecl}{npType} +\calls{npLocalDecl}{npTrap} +\calls{npLocalDecl}{npPush} +\calls{npLocalDecl}{pfSpread} +\calls{npLocalDecl}{pfParts} +\calls{npLocalDecl}{npPop2} +\calls{npLocalDecl}{npPop1} +\calls{npLocalDecl}{pfNothing} +<>= +(defun |npLocalDecl| () + (or + (and + (|npEqKey| 'colon) + (or (|npType|) (|npTrap|)) + (|npPush| (|pfSpread| (|pfParts| (|npPop2|)) (|npPop1|)))) + (|npPush| (|pfSpread| (|pfParts| (|npPop1|)) (|pfNothing|))))) + +@ + +\defun{npLocal}{npLocal} +\calls{npLocal}{npEqKey} +\calls{npLocal}{npLocalItemlist} +\calls{npLocal}{npTrap} +\calls{npLocal}{npPush} +\calls{npLocal}{pfLocal} +\calls{npLocal}{npPop1} +<>= +(defun |npLocal| () + (and + (|npEqKey| '|local|) + (or (|npLocalItemlist|) (|npTrap|)) + (|npPush| (|pfLocal| (|npPop1|))))) + +@ + +\defun{npFree}{npFree} +\calls{npFree}{npEqKey} +\calls{npFree}{npLocalItemlist} +\calls{npFree}{npTrap} +\calls{npFree}{npPush} +\calls{npFree}{pfFree} +\calls{npFree}{npPop1} +<>= +(defun |npFree| () + (and + (|npEqKey| 'free) + (or (|npLocalItemlist|) (|npTrap|)) + (|npPush| (|pfFree| (|npPop1|))))) + +@ + +\defun{npInline}{npInline} +\calls{npInline}{npAndOr} +\calls{npInline}{npQualTypelist} +\calls{npInline}{pfInline} +<>= +(defun |npInline| () + (|npAndOr| 'inline #'|npQualTypelist| #'|pfInline|)) + +@ + +\defun{npIterate}{npIterate} +\calls{npIterate}{npEqKey} +\calls{npIterate}{npPush} +\calls{npIterate}{pfIterate} +\calls{npIterate}{pfNothing} +<>= +(defun |npIterate| () + (and (|npEqKey| 'iterate) (|npPush| (|pfIterate| (|pfNothing|))))) + +@ + +\defun{npBreak}{npBreak} +\calls{npBreak}{npEqKey} +\calls{npBreak}{npPush} +\calls{npBreak}{pfBreak} +\calls{npBreak}{pfNothing} +<>= +(defun |npBreak| () + (and (|npEqKey| 'break) (|npPush| (|pfBreak| (|pfNothing|))))) + +@ + +\defun{npLoop}{npLoop} +\calls{npLoop}{npIterators} +\calls{npLoop}{npCompMissing} +\calls{npLoop}{npAssign} +\calls{npLoop}{npTrap} +\calls{npLoop}{npPush} +\calls{npLoop}{pfLp} +\calls{npLoop}{npPop2} +\calls{npLoop}{npPop1} +\calls{npLoop}{npEqKey} +\calls{npLoop}{pfLoop1} +<>= +(defun |npLoop| () + (or + (and + (|npIterators|) + (|npCompMissing| 'repeat) + (or (|npAssign|) (|npTrap|)) + (|npPush| (|pfLp| (|npPop2|) (|npPop1|)))) + (and + (|npEqKey| 'repeat) + (or (|npAssign|) (|npTrap|)) + (|npPush| (|pfLoop1| (|npPop1|)))))) + +@ + +\defun{npIterators}{npIterators} +\calls{npIterators}{npForIn} +\calls{npIterators}{npZeroOrMore} +\calls{npIterators}{npIterator} +\calls{npIterators}{npPush} +\calls{npIterators}{npPop2} +\calls{npIterators}{npPop1} +\calls{npIterators}{npWhile} +\calls{npIterators}{npIterators} +<>= +(defun |npIterators| () + (or + (and + (|npForIn|) + (|npZeroOrMore| #'|npIterator|) + (|npPush| (cons (|npPop2|) (|npPop1|)))) + (and + (|npWhile|) + (or + (and (|npIterators|) (|npPush| (cons (|npPop2|) (|npPop1|)))) + (|npPush| (list (|npPop1|))))))) + +@ + +\defun{npIterator}{npIterator} +\calls{npIterator}{npForIn} +\calls{npIterator}{npSuchThat} +\calls{npIterator}{npWhile} +<>= +(defun |npIterator| () + (or + (|npForIn|) + (|npSuchThat|) + (|npWhile|))))) + +@ + +\defun{npSuchThat}{npSuchThat} +\calls{npSuchThat}{npAndOr} +\calls{npSuchThat}{npLogical} +\calls{npSuchThat}{pfSuchthat} +<>= +(defun |npSuchThat| () + (|npAndOr| 'bar #'|npLogical| #'|pfSuchthat|)) + +@ + +\defun{npZeroOrMore}{Apply argument 0 or more times} +\calls{npZeroOrMore}{npPush} +\calls{npZeroOrMore}{npPop2} +\calls{npZeroOrMore}{npPop1} +\usesdollar{npZeroOrMore}{stack} +<>= +(defun |npZeroOrMore| (f) + (let (a) + (declare (special |$stack|)) + (cond + ((apply f nil) + (setq a |$stack|) + (setq |$stack| nil) + (do () ((not (apply f nil)))) ; while .. do + (setq |$stack| (cons (nreverse |$stack|) a)) + (|npPush| (cons (|npPop2|) (|npPop1|)))) + (t (progn (|npPush| nil) t))))) + +@ + +\defun{npWhile}{npWhile} +\calls{npWhile}{npAndOr} +\calls{npWhile}{npLogical} +\calls{npWhile}{pfWhile} +<>= +(defun |npWhile| () + (|npAndOr| 'while #'|npLogical| #'|pfWhile|)) + +@ + +\defun{npForIn}{npForIn} +\calls{npForIn}{npEqKey} +\calls{npForIn}{npVariable} +\calls{npForIn}{npTrap} +\calls{npForIn}{npCompMissing} +\calls{npForIn}{npBy} +\calls{npForIn}{npPush} +\calls{npForIn}{pfForin} +\calls{npForIn}{npPop2} +\calls{npForIn}{npPop1} +<>= +(defun |npForIn| () + (and + (|npEqKey| 'for) + (or (|npVariable|) (|npTrap|)) + (|npCompMissing| 'in) + (or (|npBy|) (|npTrap|)) + (|npPush| (|pfForin| (|npPop2|) (|npPop1|))))) + +@ + +\defun{npReturn}{npReturn} +\calls{npReturn}{npEqKey} +\calls{npReturn}{npExpress} +\calls{npReturn}{npPush} +\calls{npReturn}{pfNothing} +\calls{npReturn}{npEqKey} +\calls{npReturn}{npName} +\calls{npReturn}{npTrap} +\calls{npReturn}{pfReturn} +\calls{npReturn}{npPop2} +\calls{npReturn}{npPop1} +\calls{npReturn}{pfReturnNoName} +<>= +(defun |npReturn| () + (and + (|npEqKey| 'return) + (or + (|npExpress|) + (|npPush| (|pfNothing|))) + (or + (and + (|npEqKey| 'from) + (or (|npName|) (|npTrap|)) + (|npPush| (|pfReturn| (|npPop2|) (|npPop1|)))) + (|npPush| (|pfReturnNoName| (|npPop1|)))))) + +@ + +\defun{npVoid}{npVoid} +\calls{npVoid}{npAndOr} +\calls{npVoid}{npStatement} +\calls{npVoid}{pfNovalue} +<>= +(defun |npVoid| () + (|npAndOr| 'do #'|npStatement| #'|pfNovalue|)) + +@ + +\defun{npExpress}{npExpress} +\calls{npExpress}{npExpress1} +\calls{npExpress}{npIterators} +\calls{npExpress}{npPush} +\calls{npExpress}{pfCollect} +\calls{npExpress}{npPop2} +\calls{npExpress}{pfListOf} +\calls{npExpress}{npPop1} +<>= +(defun |npExpress| () + (and + (|npExpress1|) + (or + (and + (|npIterators|) + (|npPush| (|pfCollect| (|npPop2|) (|pfListOf| (|npPop1|))))) + t))) + +@ + +\defun{npExpress1}{npExpress1} +\calls{npExpress1}{npConditionalStatement} +\calls{npExpress1}{npADD} +<>= +(defun |npExpress1| () + (or (|npConditionalStatement|) (|npADD|))) + +@ + +\defun{npConditionalStatement}{npConditionalStatement} +\calls{npConditionalStatement}{npConditional} +\calls{npConditionalStatement}{npQualifiedDefinition} +<>= +(defun |npConditionalStatement| () + (|npConditional| #'|npQualifiedDefinition|)) + +@ + \defun{npImport}{npImport} \calls{npImport}{npAndOr} \calls{npImport}{npQualTypelist} @@ -6165,6 +6681,48 @@ fn must transform the head of the stack @ +\defun{npQualTypelist}{npQualTypelist} +\calls{npQualTypelist}{npPC} +\calls{npQualTypelist}{npSQualTypelist} +\calls{npQualTypelist}{npPush} +\calls{npQualTypelist}{pfUnSequence} +\calls{npQualTypelist}{npPop1} +<>= +(defun |npQualTypelist| () + (and + (|npPC| #'|npSQualTypelist|) + (|npPush| (|pfUnSequence| (|npPop1|))))) + +@ + +\defun{npSQualTypelist}{npSQualTypelist} +\calls{npSQualTypelist}{npListing} +\calls{npSQualTypelist}{npQualType} +\calls{npSQualTypelist}{npPush} +\calls{npSQualTypelist}{pfParts} +\calls{npSQualTypelist}{npPop1} +<>= +(defun |npSQualTypelist| () + (and + (|npListing| #'|npQualType|) + (|npPush| (|pfParts| (|npPop1|))))) + +@ + +\defun{npQualType}{npQualType} +\calls{npQualType}{npType} +\calls{npQualType}{npPush} +\calls{npQualType}{pfQualType} +\calls{npQualType}{npPop1} +\calls{npQualType}{pfNothing} +<>= +(defun |npQualType| () + (and + (|npType|) + (|npPush| (|pfQualType| (|npPop1|) (|pfNothing|))))) + +@ + \defun{npAndOr}{npAndOr} \calls{npAndOr}{npEqKey} \calls{npAndOr}{npTrap} @@ -6220,6 +6778,20 @@ fn must transform the head of the stack @ +\defun{npPDefinition}{npPDefinition} +\calls{npPDefinition}{npParenthesized} +\calls{npPDefinition}{npDefinitionlist} +\calls{npPDefinition}{npPush} +\calls{npPDefinition}{pfEnSequence} +\calls{npPDefinition}{npPop1} +<>= +(defun |npPDefinition| () + (and + (|npParenthesized| #'|npDefinitionlist|) + (|npPush| (|pfEnSequence| (|npPop1|))))) + +@ + \defun{npDollar}{npDollar} \calls{npDollar}{npEqPeek} \calls{npDollar}{npPush} @@ -6835,6 +7407,83 @@ fn must transform the head of the stack @ +\defun{npSegment}{npSegment} +\calls{npSegment}{npEqPeek} +\calls{npSegment}{npPushId} +\calls{npSegment}{npFromdom} +<>= +(defun |npSegment| () + (and (|npEqPeek| 'seg) (|npPushId|) (|npFromdom|))) + +@ + +\defun{npArith}{npArith} +\calls{npArith}{npLeftAssoc} +\calls{npArith}{npSum} +<>= +(defun |npArith| () + (|npLeftAssoc| '(mod) #'|npSum|)) + +@ + +\defun{npSum}{npSum} +\calls{npSum}{npLeftAssoc} +\calls{npSum}{npTerm} +<>= +(defun |npSum| () + (|npLeftAssoc| '(plus minus) #'|npTerm|)) + +@ + +\defun{npTerm}{npTerm} +\calls{npTerm}{npInfGeneric} +\calls{npTerm}{npRemainder} +\calls{npTerm}{npPush} +\calls{npTerm}{pfApplication} +\calls{npTerm}{npPop2} +\calls{npTerm}{npPop1} +<>= +(defun |npTerm| () + (or + (and + (|npInfGeneric| '(minus plus)) + (or + (and (|npRemainder|) (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) + t)) + (|npRemainder|))) + +@ + +\defun{npRemainder}{npRemainder} +\calls{npRemainder}{npLeftAssoc} +\calls{npRemainder}{npProduct} +<>= +(defun |npRemainder| () + (|npLeftAssoc| '(rem quo) #'|npProduct|)) + +@ + +\defun{npProduct}{npProduct} +\calls{npProduct}{npLeftAssoc} +\calls{npProduct}{npPower} +<>= +(defun |npProduct| () + (|npLeftAssoc| + '(times slash backslash slashslash backslashbackslash + slashbackslash backslashslash) + #'|npPower|)) + +@ + +\defun{npPower}{npPower} +\calls{npPower}{npRightAssoc} +\calls{npPower}{npColon} +<>= +(defun |npPower| () + (|npRightAssoc| '(power carat) #'|npColon|)) + +@ + \defun{npAmpersandFrom}{npAmpersandFrom} \calls{npAmpersandFrom}{npAmpersand} \calls{npAmpersandFrom}{npFromdom} @@ -7276,6 +7925,23 @@ This was rewritten by NAG to remove flet. @ +\defun{npDecl}{npDecl} +\calls{npDecl}{npEqKey} +\calls{npDecl}{npType} +\calls{npDecl}{npTrap} +\calls{npDecl}{npPush} +\calls{npDecl}{pfTyped} +\calls{npDecl}{npPop2} +\calls{npDecl}{npPop1} +<>= +(defun |npDecl| () + (and + (|npEqKey| 'colon) + (or (|npType|) (|npTrap|)) + (|npPush| (|pfTyped| (|npPop2|) (|npPop1|))))) + +@ + \defun{npParenthesized}{npParenthesized} \calls{npParenthesized}{npParenthesize} <>= @@ -7396,6 +8062,104 @@ This was rewritten by NAG to remove flet. @ +\defun{npTagged}{npTagged} +\calls{npTagged}{npTypedForm1} +\calls{npTagged}{pfTagged} +<>= +(defun |npTagged| () + (|npTypedForm1| 'colon #'|pfTagged|)) + +@ + +\defun{npTypedForm1}{npTypedForm1} +\calls{npTypedForm1}{npEqKey} +\calls{npTypedForm1}{npType} +\calls{npTypedForm1}{npTrap} +\calls{npTypedForm1}{npPush} +\calls{npTypedForm1}{npPop2} +\calls{npTypedForm1}{npPop1} +<>= +(defun |npTypedForm1| (sy fn) + (and + (|npEqKey| sy) + (or (|npType|) (|npTrap|)) + (|npPush| (funcall fn (|npPop2|) (|npPop1|))))) + +@ + +\defun{npTypified}{npTypified} +\calls{npTypified}{npApplication} +\calls{npTypified}{npAnyNo} +\calls{npTypified}{npTypeStyle} +<>= +(defun |npTypified| () + (and (|npApplication|) (|npAnyNo| #'|npTypeStyle|))) + +@ + +\defun{npTypeStyle}{npTypeStyle} +\calls{npTypeStyle}{npCoerceTo} +\calls{npTypeStyle}{npRestrict} +\calls{npTypeStyle}{npPretend} +\calls{npTypeStyle}{npColonQuery} +<>= +(defun |npTypeStyle| () + (or (|npCoerceTo|) (|npRestrict|) (|npPretend|) (|npColonQuery|))) + +@ + +\defun{npPretend}{npPretend} +\calls{npPretend}{npTypedForm} +\calls{npPretend}{pfPretend} +<>= +(defun |npPretend| () + (|npTypedForm| 'pretend #'|pfPretend|)) + +@ + +\defun{npColonQuery}{npColonQuery} +\calls{npColonQuery}{npTypedForm} +\calls{npColonQuery}{pfRetractTo} +<>= +(defun |npColonQuery| () + (|npTypedForm| 'atat #'|pfRetractTo|)) + +@ + +\defun{npCoerceTo}{npCoerceTo} +\calls{npCoerceTo}{npTypedForm} +\calls{npCoerceTo}{pfCoerceto} +<>= +(defun |npCoerceTo| () + (|npTypedForm| 'coerce #'|pfCoerceto|)) + +@ + +\defun{npTypedForm}{npTypedForm} +\calls{npTypedForm}{npEqKey} +\calls{npTypedForm}{npApplication} +\calls{npTypedForm}{npTrap} +\calls{npTypedForm}{npPush} +\calls{npTypedForm}{npPop2} +\calls{npTypedForm}{npPop1} +<>= +(defun |npTypedForm| (sy fn) + (and + (|npEqKey| sy) + (or (|npApplication|) (|npTrap|)) + (|npPush| (funcall fn (|npPop2|) (|npPop1|))))) + +@ + +\defun{npRestrict}{npRestrict} +\calls{npRestrict}{npTypedForm} +\calls{npRestrict}{pfRestrict} +<>= +(defun |npRestrict| () + (|npTypedForm| 'at #'|pfRestrict|)) + +@ + \defun{npListofFun}{npListofFun} \calls{npListofFun}{npTrap} \calls{npListofFun}{npPush} @@ -8129,6 +8893,14 @@ of the form ('expression expr position) @ +\defun{pfBreak}{Create a Break node} +\calls{pfBreak}{pfTree} +<>= +(defun |pfBreak| (pffrom) + (|pfTree| '|Break| (list pffrom))) + +@ + \defun{pfBreak?}{Is this a Break node?} \calls{pfBreak?}{pfAbSynOp?} <>= @@ -8144,6 +8916,14 @@ of the form ('expression expr position) @ +\defun{pfCoerceto}{Construct a Coerceto node} +\calls{pfCoerceto}{pfTree} +<>= +(defun |pfCoerceto| (pfexpr pftype) + (|pfTree| '|Coerceto| (list pfexpr pftype))) + +@ + \defun{pfCoerceto?}{Is this a CoerceTo node?} \calls{pfCoerceto?}{pfAbSynOp?} <>= @@ -8285,6 +9065,14 @@ of the form ('expression expr position) @ +\defun{pfExport}{Create an Export node} +\calls{pfExport}{pfTree} +<>= +(defun |pfExport| (pfitems) + (|pfTree| '|Export| (list pfitems))) + +@ + \defun{pfExpression}{Construct an Expression leaf node} \calls{pfExpression}{pfLeaf} \calls{pfExpression}{ifcar} @@ -8310,6 +9098,14 @@ of the form ('expression expr position) @ +\defun{pfFree}{Create a Free node} +\calls{pfFree}{pfTree} +<>= +(defun |pfFree| (pfitems) + (|pfTree| '|Free| (list pfitems))) + +@ + \defun{pfFree?}{Is this a Free node?} \calls{pfFree?}{pfAbSynOp?} <>= @@ -8334,6 +9130,14 @@ of the form ('expression expr position) @ +\defun{pfForin}{Construct a Forin node} +\calls{pfForin}{pfTree} +<>= +(defun |pfForin| (pflhs pfwhole) + (|pfTree| '|Forin| (list pflhs pfwhole))) + +@ + \defun{pfForin?}{Is this a ForIn node?} \calls{pfForin?}{pfAbSynOp?} <>= @@ -8467,6 +9271,14 @@ of the form ('expression expr position) @ +\defun{pfIterate}{Construct an Iterate node} +\calls{pfIterate}{pfTree} +<>= +(defun |pfIterate| (pffrom) + (|pfTree| '|Iterate| (list pffrom))) + +@ + \defun{pfIterate?}{Is this an Iterate node?} \calls{pfIterate?}{pfAbSynOp?} <>= @@ -8491,6 +9303,14 @@ of the form ('expression expr position) @ +\defun{pfInline}{Create an Inline node} +\calls{pfInline}{pfTree} +<>= +(defun |pfInline| (pfitems) + (|pfTree| '|Inline| (list pfitems))) + +@ + \defun{pfLam}{pfLam} \calls{pfLam}{pfAbSynOp?} \calls{pfLam}{pfFirst} @@ -8695,6 +9515,14 @@ of the form ('expression expr position) @ +\defun{pfPretend}{pfPretend} +\calls{pfPretend}{pfTree} +<>= +(defun |pfPretend| (pfexpr pftype) + (|pfTree| '|Pretend| (list pfexpr pftype))) + +@ + \defun{pfPretend?}{Is this a Pretend node?} \calls{pfPretend?}{pfAbSynOp?} <>= @@ -8717,6 +9545,22 @@ of the form ('expression expr position) @ +\defun{pfQualType}{Construct a QualType node} +\calls{pfQualType}{pfTree} +<>= +(defun |pfQualType| (pftype pfqual) + (|pfTree| '|QualType| (list pftype pfqual))) + +@ + +\defun{pfRestrict}{Construct a Restrict node} +\calls{pfRestrict}{pfTree} +<>= +(defun |pfRestrict| (pfexpr pftype) + (|pfTree| '|Restrict| (list pfexpr pftype))) + +@ + \defun{pfRestrict?}{Is this a Restrict node?} \calls{pfRestrict?}{pfAbSynOp?} <>= @@ -8739,6 +9583,22 @@ of the form ('expression expr position) @ +\defun{pfRetractTo}{Construct a RetractTo node} +\calls{pfRetractTo}{pfTree} +<>= +(defun |pfRetractTo| (pfexpr pftype) + (|pfTree| '|RetractTo| (list pfexpr pftype))) + +@ + +\defun{pfReturn}{Construct a Return node} +\calls{pfReturn}{pfTree} +<>= +(defun |pfReturn| (pfexpr pffrom) + (|pfTree| '|Return| (list pfexpr pffrom))) + +@ + \defun{pfReturn?}{Is this a Return node?} \calls{pfReturn?}{pfAbSynOp?} <>= @@ -8754,6 +9614,15 @@ of the form ('expression expr position) @ +\defun{pfReturnNoName}{pfReturnNoName} +\calls{pfReturnNoName}{pfReturn} +\calls{pfReturnNoName}{pfNothing} +<>= +(defun |pfReturnNoName| (|value|) + (|pfReturn| |value| (|pfNothing|))) + +@ + \defun{pfReturnTyped}{Construct a ReturnTyped node} \calls{pfReturnTyped}{pfTree} <>= @@ -8846,6 +9715,14 @@ of the form ('expression expr position) @ +\defun{pfTagged}{Create a Tagged node} +\calls{pfTagged}{pfTree} +<>= +(defun |pfTagged| (pftag pfexpr) + (|pfTree| '|Tagged| (list pftag pfexpr))) + +@ + \defun{pfTagged?}{Is this a Tagged node?} \calls{pfTagged?}{pfAbSynOp?} <>= @@ -9034,6 +9911,14 @@ of the form ('expression expr position) @ +\defun{pfWhile}{Construct a While node} +\calls{pfWhile}{pfTree} +<>= +(defun |pfWhile| (pfcond) + (|pfTree| '|While| (list pfcond))) + +@ + \defun{pfWhile?}{Is this a While node?} \calls{pfWhile?}{pfAbSynOp?} <>= @@ -9524,12 +10409,12 @@ output is an old-parser-style s-expression. <>= (defun |hasOptArgs?| (argSex) (let (rhs lhs opt nonOpt tmp1 tmp2) - (dolist (|arg| argSex) + (dolist (arg argSex) (cond - ((and (consp |arg|) - (eq (car |arg|) 'optarg) + ((and (consp arg) + (eq (car arg) 'optarg) (progn - (setq tmp1 (cdr |arg|)) + (setq tmp1 (cdr arg)) (and (consp tmp1) (progn (setq lhs (car tmp1)) @@ -9540,7 +10425,7 @@ output is an old-parser-style s-expression. (setq rhs (car tmp2)) t)))))) (setq opt (cons (list lhs rhs) opt))) - (t (setq nonOpt (cons |arg| nonOpt))))) + (t (setq nonOpt (cons arg nonOpt))))) (when opt (nconc (nreverse nonOpt) (list (cons '|construct| (nreverse opt))))))) @@ -25461,14 +26346,14 @@ double enforce DOUBLE PRECISION ASPs on \calls{setNagHost}{describeSetNagHost} \usesdollar{setNagHost}{nagHost} <>= -(defun |setNagHost| (|arg|) +(defun |setNagHost| (arg) (declare (special |$nagHost|)) (cond - ((eq |arg| '|%initialize%|) (setq |$nagHost| "localhost")) - ((eq |arg| '|%display%|) (|object2String| |$nagHost|)) - ((or (null |arg|) (eq |arg| '|%describe%|) (eq (car |arg|) '?)) + ((eq arg '|%initialize%|) (setq |$nagHost| "localhost")) + ((eq arg '|%display%|) (|object2String| |$nagHost|)) + ((or (null arg) (eq arg '|%describe%|) (eq (car arg) '?)) (|describeSetNagHost|)) - (t (setq |$nagHost| (|object2String| |arg|))))) + (t (setq |$nagHost| (|object2String| arg))))) @ @@ -37792,6 +38677,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -37805,17 +38691,25 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> +<> <> +<> <> <> <> <> +<> <> <> +<> <> +<> +<> +<> <> <> <> @@ -37834,8 +38728,13 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> +<> <> <> +<> +<> <> <> <> @@ -37845,9 +38744,13 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> +<> +<> +<> <> <> <> @@ -37857,9 +38760,17 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> +<> +<> +<> <> +<> <> <> +<> +<> +<> <> <> <> @@ -37870,56 +38781,85 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> <> <> +<> <> <> <> <> <> +<> <> <> <> <> +<> <> <> <> +<> <> +<> <> +<> +<> <> <> <> +<> +<> <> <> <> -<> -<> -<> -<> +<> +<> <> <> <> +<> +<> +<> <> +<> +<> +<> +<> <> <> +<> +<> <> <> <> <> <> +<> +<> <> <> <> <> +<> +<> +<> +<> +<> +<> +<> <> <> <> +<> <> +<> <> +<> <> <> @@ -37963,9 +38903,11 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> +<> <> <> <> @@ -37989,12 +38931,15 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> +<> <> <> +<> <> <> <> @@ -38015,7 +38960,9 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> +<> <> <> <> @@ -38058,15 +39005,21 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> <> +<> +<> <> <> <> +<> +<> <> <> +<> <> <> <> @@ -38093,6 +39046,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> @@ -38114,6 +39068,7 @@ This needs to work off the internal exposure list, not the file. <> <> <> +<> <> <> <> diff --git a/changelog b/changelog index 67f1eae..7592b65 100644 --- a/changelog +++ b/changelog @@ -1,4 +1,9 @@ -20100222 tpd src/axiom-website/patches.html 20100222.01.tpd.patch +20100222 tpd src/axiom-website/patches.html 20100222.03.tpd.patch +20100222 tpd src/interp/Makefile remove cparse +20100222 tpd src/interp/cparse.lisp removed +20100222 tpd src/interp/ptrees.lisp treeshake +20100222 tpd books/bookvol5 merge and remove cparse, treeshake ptrees +20100222 tpd src/axiom-website/patches.html 20100222.02.tpd.patch 20100222 tpd src/input/unittest2.input fix broken credit test 20100222 tpd src/axiom-website/patches.html 20100222.01.tpd.patch 20100222 tpd src/interp/cparse.lisp treeshake diff --git a/src/axiom-website/patches.html b/src/axiom-website/patches.html index 03e9082..2141090 100644 --- a/src/axiom-website/patches.html +++ b/src/axiom-website/patches.html @@ -2485,7 +2485,9 @@ books/bookvol5 treeshake cparse, ptrees
src/input/unittest2.input fix broken credit test
20100222.01.tpd.patch books/bookvol5 treeshake cparse
-20100222.01.tpd.patch +20100222.02.tpd.patch src/input/unittest2.input fix broken credit test
+20100222.03.tpd.patch +books/bookvol5 merge and remove cparse, treeshake ptrees
diff --git a/src/interp/Makefile.pamphlet b/src/interp/Makefile.pamphlet index 0ec52fa..10f3081 100644 --- a/src/interp/Makefile.pamphlet +++ b/src/interp/Makefile.pamphlet @@ -145,7 +145,6 @@ OBJS= ${OUT}/vmlisp.${O} \ ${OUT}/cfuns.${O} \ ${OUT}/clam.${O} ${OUT}/clammed.${O} \ ${OUT}/compress.${O} \ - ${OUT}/cparse.${O} \ ${OUT}/database.${O} \ ${OUT}/format.${O} \ ${OUT}/g-boot.${O} ${OUT}/g-cndata.${O} \ @@ -3135,29 +3134,6 @@ ${MID}/topics.lisp: ${IN}/topics.lisp.pamphlet @ -\subsection{cparse.lisp} -<>= -${OUT}/cparse.${O}: ${MID}/cparse.lisp - @ echo 136 making ${OUT}/cparse.${O} from ${MID}/cparse.lisp - @ ( cd ${MID} ; \ - if [ -z "${NOISE}" ] ; then \ - echo '(progn (compile-file "${MID}/cparse.lisp"' \ - ':output-file "${OUT}/cparse.${O}") (${BYE}))' | ${DEPSYS} ; \ - else \ - echo '(progn (compile-file "${MID}/cparse.lisp"' \ - ':output-file "${OUT}/cparse.${O}") (${BYE}))' | ${DEPSYS} \ - >${TMP}/trace ; \ - fi ) - -@ -<>= -${MID}/cparse.lisp: ${IN}/cparse.lisp.pamphlet - @ echo 137 making ${MID}/cparse.lisp from ${IN}/cparse.lisp.pamphlet - @ (cd ${MID} ; \ - ${TANGLE} ${IN}/cparse.lisp.pamphlet >cparse.lisp ) - -@ - \subsection{macex.lisp} <>= ${OUT}/macex.${O}: ${MID}/macex.lisp @@ -3647,9 +3623,6 @@ clean: <> <> -<> -<> - <> <> <> diff --git a/src/interp/cparse.lisp.pamphlet b/src/interp/cparse.lisp.pamphlet index bc3eb7e..f0d7311 100644 --- a/src/interp/cparse.lisp.pamphlet +++ b/src/interp/cparse.lisp.pamphlet @@ -15,224 +15,6 @@ ;-- Parsing functions -;npTypedForm1(sy,fn) == -; npEqKey sy and (npType() or npTrap()) and -; npPush FUNCALL(fn,npPop2(),npPop1()) -(DEFUN |npTypedForm1| (|sy| |fn|) - (PROG NIL - (RETURN - (AND - (|npEqKey| |sy|) - (OR (|npType|) (|npTrap|)) - (|npPush| (FUNCALL |fn| (|npPop2|) (|npPop1|))))))) - -;npTypedForm(sy,fn) == -; npEqKey sy and (npApplication() or npTrap()) and -; npPush FUNCALL(fn,npPop2(),npPop1()) -(DEFUN |npTypedForm| (|sy| |fn|) - (PROG NIL - (RETURN - (AND - (|npEqKey| |sy|) - (OR (|npApplication|) (|npTrap|)) - (|npPush| (FUNCALL |fn| (|npPop2|) (|npPop1|))))))) - -;npRestrict() == npTypedForm("AT",function pfRestrict) -(DEFUN |npRestrict| () - (PROG NIL - (RETURN - (|npTypedForm| (QUOTE AT) (FUNCTION |pfRestrict|))))) - -;npCoerceTo() == npTypedForm("COERCE",function pfCoerceto) -(DEFUN |npCoerceTo| () - (PROG NIL - (RETURN - (|npTypedForm| (QUOTE COERCE) (FUNCTION |pfCoerceto|))))) - -;npColonQuery() == npTypedForm("ATAT",function pfRetractTo) -(DEFUN |npColonQuery| () - (PROG NIL - (RETURN - (|npTypedForm| (QUOTE ATAT) (FUNCTION |pfRetractTo|))))) - -;npPretend() == npTypedForm("PRETEND",function pfPretend) -(DEFUN |npPretend| () - (PROG NIL - (RETURN - (|npTypedForm| (QUOTE PRETEND) (FUNCTION |pfPretend|))))) - -;npTypeStyle()== -; npCoerceTo() or npRestrict() or npPretend() or npColonQuery() -(DEFUN |npTypeStyle| () - (PROG NIL - (RETURN - (OR (|npCoerceTo|) (|npRestrict|) (|npPretend|) (|npColonQuery|))))) - -;npTypified ()==npApplication() and npAnyNo function npTypeStyle -(DEFUN |npTypified| () - (PROG NIL - (RETURN - (AND (|npApplication|) (|npAnyNo| (FUNCTION |npTypeStyle|)))))) - -;npTagged() == npTypedForm1("COLON",function pfTagged) -(DEFUN |npTagged| () - (PROG NIL - (RETURN - (|npTypedForm1| (QUOTE COLON) (FUNCTION |pfTagged|))))) - -;npPower() == npRightAssoc('(POWER CARAT),function npColon) -(DEFUN |npPower| () - (PROG NIL - (RETURN - (|npRightAssoc| (QUOTE (POWER CARAT)) (FUNCTION |npColon|))))) - -;npProduct()== -; npLeftAssoc('(TIMES SLASH BACKSLASH SLASHSLASH -; BACKSLASHBACKSLASH SLASHBACKSLASH BACKSLASHSLASH ) -; ,function npPower) -(DEFUN |npProduct| () - (PROG NIL - (RETURN - (|npLeftAssoc| - (QUOTE (TIMES SLASH BACKSLASH SLASHSLASH BACKSLASHBACKSLASH - SLASHBACKSLASH BACKSLASHSLASH)) - (FUNCTION |npPower|))))) - -;npRemainder()== -; npLeftAssoc('(REM QUO ) ,function npProduct) -(DEFUN |npRemainder| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (REM QUO)) (FUNCTION |npProduct|))))) - -;npTerm()== -; npInfGeneric '(MINUS PLUS) and (npRemainder() -; and npPush(pfApplication(npPop2(),npPop1())) or true) -; or npRemainder() -(DEFUN |npTerm| () - (PROG NIL - (RETURN - (OR - (AND - (|npInfGeneric| (QUOTE (MINUS PLUS))) - (OR - (AND (|npRemainder|) (|npPush| (|pfApplication| (|npPop2|) (|npPop1|)))) - T)) - (|npRemainder|))))) - -; -;npSum()==npLeftAssoc('(PLUS MINUS),function npTerm) -(DEFUN |npSum| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (PLUS MINUS)) (FUNCTION |npTerm|))))) - -;npArith()==npLeftAssoc('(MOD),function npSum) -(DEFUN |npArith| () - (PROG NIL - (RETURN - (|npLeftAssoc| (QUOTE (MOD)) (FUNCTION |npSum|))))) - -;npSegment()== npEqPeek "SEG" and npPushId() and npFromdom() -(DEFUN |npSegment| () - (PROG NIL - (RETURN - (AND (|npEqPeek| (QUOTE SEG)) (|npPushId|) (|npFromdom|))))) - -;npConditionalStatement()==npConditional function npQualifiedDefinition -(DEFUN |npConditionalStatement| () - (PROG NIL - (RETURN - (|npConditional| (FUNCTION |npQualifiedDefinition|))))) - -;npExpress1()==npConditionalStatement() or npADD() -(DEFUN |npExpress1| () - (PROG NIL - (RETURN - (OR (|npConditionalStatement|) (|npADD|))))) - -;npExpress()== -; npExpress1() and -; (npIterators() and -; npPush pfCollect (npPop2(),pfListOf npPop1()) or true) -(DEFUN |npExpress| () - (PROG NIL - (RETURN - (AND - (|npExpress1|) - (OR - (AND - (|npIterators|) - (|npPush| (|pfCollect| (|npPop2|) (|pfListOf| (|npPop1|))))) - T))))) - -;npZeroOrMore f== -; APPLY(f,nil)=> -; a:=$stack -; $stack:=nil -; while APPLY(f,nil) repeat 0 -; $stack:=cons(NREVERSE $stack,a) -; npPush cons(npPop2(),npPop1()) -; npPush nil -; true -(DEFUN |npZeroOrMore| (|f|) - (PROG (|a|) - (DECLARE (SPECIAL |$stack|)) - (RETURN - (COND - ((APPLY |f| NIL) - (PROGN - (SETQ |a| |$stack|) - (SETQ |$stack| NIL) - ((LAMBDA () - (LOOP - (COND - ((NOT (APPLY |f| NIL)) (RETURN NIL)) - ((QUOTE T) 0))))) - (SETQ |$stack| (CONS (NREVERSE |$stack|) |a|)) - (|npPush| (CONS (|npPop2|) (|npPop1|))))) - ((QUOTE T) (PROGN (|npPush| NIL) T)))))) - -;npIterators()== -; npForIn() and npZeroOrMore function npIterator -; and npPush cons(npPop2(),npPop1()) or -; npWhile() and (npIterators() and -; npPush cons(npPop2(),npPop1()) or npPush [npPop1()]) -(DEFUN |npIterators| () - (PROG NIL - (RETURN - (OR - (AND - (|npForIn|) - (|npZeroOrMore| (FUNCTION |npIterator|)) - (|npPush| (CONS (|npPop2|) (|npPop1|)))) - (AND - (|npWhile|) - (OR - (AND (|npIterators|) (|npPush| (CONS (|npPop2|) (|npPop1|)))) - (|npPush| (LIST (|npPop1|))))))))) - -;npIterator()== npForIn() or npSuchThat() or npWhile() -(DEFUN |npIterator| () - (PROG NIL - (RETURN - (OR - (|npForIn|) - (|npSuchThat|) - (|npWhile|))))) - -;npMDEF()== npBackTrack(function npStatement,"MDEF",function npMDEFinition) -(DEFUN |npMDEF| () - (PROG NIL - (RETURN - (|npBackTrack| (FUNCTION |npStatement|) 'MDEF (FUNCTION |npMDEFinition|))))) - -;npMDEFinition() == npPP function npMdef -(DEFUN |npMDEFinition| () - (PROG NIL - (RETURN - (|npPP| (FUNCTION |npMdef|))))) - ;npAssignVariableName()==npApplication() and ; a:=npPop1() ; if pfId? a @@ -253,379 +35,14 @@ (|npPush| (|pfTyped| (|npPop1|) (|pfNothing|))))) ((QUOTE T) (|npPush| |a|)))))))) +(trace npAssignVariableName|) ;npAssignVariablelist()== npListing function npAssignVariableName (DEFUN |npAssignVariablelist| () (PROG NIL (RETURN (|npListing| (FUNCTION |npAssignVariableName|))))) - -;npVoid()== npAndOr("DO",function npStatement,function pfNovalue) -(DEFUN |npVoid| () - (PROG NIL - (RETURN - (|npAndOr| (QUOTE DO) (FUNCTION |npStatement|) (FUNCTION |pfNovalue|))))) - -;npReturn()== -; npEqKey "RETURN" and -; (npExpress() or npPush pfNothing()) and -; (npEqKey "FROM" and (npName() or npTrap()) and -; npPush pfReturn (npPop2(),npPop1()) or -; npPush pfReturnNoName npPop1()) -(DEFUN |npReturn| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE RETURN)) - (OR - (|npExpress|) - (|npPush| (|pfNothing|))) - (OR - (AND - (|npEqKey| (QUOTE FROM)) - (OR (|npName|) (|npTrap|)) - (|npPush| (|pfReturn| (|npPop2|) (|npPop1|)))) - (|npPush| (|pfReturnNoName| (|npPop1|)))))))) - -;npLoop()== -; npIterators() and -; (npCompMissing "REPEAT" and -; (npAssign() or npTrap()) and -; npPush pfLp(npPop2(),npPop1())) -; or -; npEqKey "REPEAT" and (npAssign() or npTrap()) and -; npPush pfLoop1 npPop1 () -(DEFUN |npLoop| () - (PROG NIL - (RETURN - (OR - (AND - (|npIterators|) - (|npCompMissing| (QUOTE REPEAT)) - (OR (|npAssign|) (|npTrap|)) - (|npPush| (|pfLp| (|npPop2|) (|npPop1|)))) - (AND - (|npEqKey| (QUOTE REPEAT)) - (OR (|npAssign|) (|npTrap|)) - (|npPush| (|pfLoop1| (|npPop1|)))))))) - -;npSuchThat()==npAndOr("BAR",function npLogical,function pfSuchthat) -(DEFUN |npSuchThat| () - (PROG NIL - (RETURN - (|npAndOr| (QUOTE BAR) (FUNCTION |npLogical|) (FUNCTION |pfSuchthat|))))) - -;npWhile()==npAndOr ("WHILE",function npLogical,function pfWhile) -(DEFUN |npWhile| () - (PROG NIL - (RETURN - (|npAndOr| (QUOTE WHILE) (FUNCTION |npLogical|) (FUNCTION |pfWhile|))))) - -;npForIn()== -; npEqKey "FOR" and (npVariable() or npTrap()) and (npCompMissing "IN") -; and ((npBy() or npTrap()) and -; npPush pfForin(npPop2(),npPop1())) -(DEFUN |npForIn| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE FOR)) - (OR (|npVariable|) (|npTrap|)) - (|npCompMissing| (QUOTE IN)) - (OR (|npBy|) (|npTrap|)) - (|npPush| (|pfForin| (|npPop2|) (|npPop1|))))))) - -;npBreak()== -; npEqKey "BREAK" and npPush pfBreak pfNothing () -(DEFUN |npBreak| () - (PROG NIL - (RETURN - (AND (|npEqKey| (QUOTE BREAK)) (|npPush| (|pfBreak| (|pfNothing|))))))) - -;npIterate()== -; npEqKey "ITERATE" and npPush pfIterate pfNothing () -(DEFUN |npIterate| () - (PROG NIL - (RETURN - (AND (|npEqKey| (QUOTE ITERATE)) (|npPush| (|pfIterate| (|pfNothing|))))))) - -;npQualType()== -; npType() and -; npPush pfQualType(npPop1(),pfNothing()) -(DEFUN |npQualType| () - (PROG NIL - (RETURN - (AND - (|npType|) - (|npPush| (|pfQualType| (|npPop1|) (|pfNothing|))))))) - -;npSQualTypelist()== npListing function npQualType -; and npPush pfParts npPop1 () -(DEFUN |npSQualTypelist| () - (PROG NIL - (RETURN - (AND - (|npListing| (FUNCTION |npQualType|)) - (|npPush| (|pfParts| (|npPop1|))))))) - -;npQualTypelist()== npPC function npSQualTypelist -; and npPush pfUnSequence npPop1 () -(DEFUN |npQualTypelist| () - (PROG NIL - (RETURN - (AND - (|npPC| (FUNCTION |npSQualTypelist|)) - (|npPush| (|pfUnSequence| (|npPop1|))))))) - -;npInline()==npAndOr("INLINE",function npQualTypelist,function pfInline) -(DEFUN |npInline| () - (PROG NIL - (RETURN - (|npAndOr| 'INLINE (FUNCTION |npQualTypelist|) (FUNCTION |pfInline|))))) - -;npLocalDecl()== npEqKey "COLON" and (npType() or npTrap()) and -; npPush pfSpread (pfParts npPop2(),npPop1()) or -; npPush pfSpread (pfParts npPop1(),pfNothing()) -(DEFUN |npLocalDecl| () - (PROG NIL - (RETURN - (OR - (AND - (|npEqKey| (QUOTE COLON)) - (OR (|npType|) (|npTrap|)) - (|npPush| (|pfSpread| (|pfParts| (|npPop2|)) (|npPop1|)))) - (|npPush| (|pfSpread| (|pfParts| (|npPop1|)) (|pfNothing|))))))) - -;npLocalItem()==npTypeVariable() and npLocalDecl() -(DEFUN |npLocalItem| () - (PROG NIL - (RETURN - (AND - (|npTypeVariable|) - (|npLocalDecl|))))) - -;npLocalItemlist()== npPC function npSLocalItem -; and npPush pfUnSequence npPop1 () -(DEFUN |npLocalItemlist| () - (PROG NIL - (RETURN - (AND - (|npPC| (FUNCTION |npSLocalItem|)) - (|npPush| (|pfUnSequence| (|npPop1|))))))) - -;npSLocalItem()== npListing function npLocalItem -; and npPush pfAppend pfParts npPop1() -(DEFUN |npSLocalItem| () - (PROG NIL - (RETURN - (AND - (|npListing| (FUNCTION |npLocalItem|)) - (|npPush| (|pfAppend| (|pfParts| (|npPop1|)))))))) - -;npFree()== npEqKey "FREE" and (npLocalItemlist() or npTrap()) -; and npPush pfFree npPop1() -(DEFUN |npFree| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE FREE)) - (OR (|npLocalItemlist|) (|npTrap|)) - (|npPush| (|pfFree| (|npPop1|))))))) - -;npLocal()== npEqKey "local" and (npLocalItemlist() or npTrap()) -; and npPush pfLocal npPop1() -(DEFUN |npLocal| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE |local|)) - (OR (|npLocalItemlist|) (|npTrap|)) - (|npPush| (|pfLocal| (|npPop1|))))))) - -;npExport()== npEqKey "EXPORT" and (npLocalItemlist() or npTrap()) -; and npPush pfExport npPop1() -(DEFUN |npExport| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE EXPORT)) - (OR (|npLocalItemlist|) (|npTrap|)) - (|npPush| (|pfExport| (|npPop1|))))))) - -;npSignatureDefinee()== -; npName() or npInfixOperator() or npPrefixColon() -(DEFUN |npSignatureDefinee| () - (PROG NIL - (RETURN - (OR (|npName|) (|npInfixOperator|) (|npPrefixColon|))))) - -;npDecl()== npEqKey "COLON" and (npType() or npTrap()) and -; npPush pfTyped (npPop2(),npPop1()) -(DEFUN |npDecl| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE COLON)) - (OR (|npType|) (|npTrap|)) - (|npPush| (|pfTyped| (|npPop2|) (|npPop1|))))))) - -;npQualified(f)== -; if FUNCALL f -; then -; while npEqKey "WHERE" and (npDefinition() or npTrap()) repeat -; npPush pfWhere(npPop1(),npPop1()) -; true -; else npLetQualified f -(DEFUN |npQualified| (|f|) - (PROG NIL - (RETURN - (COND - ((FUNCALL |f|) - ((LAMBDA NIL - (LOOP - (COND - ((NOT (AND (|npEqKey| (QUOTE WHERE)) (OR (|npDefinition|) (|npTrap|)))) - (RETURN NIL)) - ((QUOTE T) - (|npPush| (|pfWhere| (|npPop1|) (|npPop1|)))))))) T) - ((QUOTE T) (|npLetQualified| |f|)))))) - -;npQualifiedDefinition()== -; npQualified function npDefinitionOrStatement -(DEFUN |npQualifiedDefinition| () - (PROG NIL - (RETURN - (|npQualified| (FUNCTION |npDefinitionOrStatement|))))) - -;npTuple (p)== -; npListofFun(p,function npCommaBackSet,function pfTupleListOf) -(DEFUN |npTuple| (|p|) - (PROG NIL - (RETURN - (|npListofFun| |p| - (FUNCTION |npCommaBackSet|) - (FUNCTION |pfTupleListOf|))))) - -;npComma()== npTuple function npQualifiedDefinition -(DEFUN |npComma| () - (PROG NIL - (RETURN - (|npTuple| (FUNCTION |npQualifiedDefinition|))))) - -;npQualDef()== npComma() and npPush [npPop1()] -(DEFUN |npQualDef| () - (PROG NIL - (RETURN - (AND - (|npComma|) - (|npPush| (LIST (|npPop1|))))))) - -;npPDefinition ()== -; npParenthesized function npDefinitionlist and -; npPush pfEnSequence npPop1() -(DEFUN |npPDefinition| () - (PROG NIL - (RETURN - (AND - (|npParenthesized| (FUNCTION |npDefinitionlist|)) - (|npPush| (|pfEnSequence| (|npPop1|))))))) - -;npTypeVariable()== npParenthesized function npTypeVariablelist or -; npSignatureDefinee() and npPush pfListOf [npPop1()] -(DEFUN |npTypeVariable| () - (PROG NIL - (RETURN - (OR - (|npParenthesized| (FUNCTION |npTypeVariablelist|)) - (AND (|npSignatureDefinee|) (|npPush| (|pfListOf| (LIST (|npPop1|))))))))) - -;npTypeVariablelist()== npListing function npSignatureDefinee -(DEFUN |npTypeVariablelist| () - (PROG NIL - (RETURN - (|npListing| (FUNCTION |npSignatureDefinee|))))) - -;npTyping()== -; npEqKey "DEFAULT" and (npDefaultItemlist() or npTrap()) -; and npPush pfTyping npPop1() -(DEFUN |npTyping| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE DEFAULT)) - (OR (|npDefaultItemlist|) (|npTrap|)) - (|npPush| (|pfTyping| (|npPop1|))))))) - -;npDefaultItemlist()== npPC function npSDefaultItem -; and npPush pfUnSequence npPop1 () -(DEFUN |npDefaultItemlist| () - (PROG NIL - (RETURN - (AND - (|npPC| (FUNCTION |npSDefaultItem|)) - (|npPush| (|pfUnSequence| (|npPop1|))))))) - -;npDefaultDecl()== npEqKey "COLON" and (npType() or npTrap()) and -; npPush pfSpread (pfParts npPop2(),npPop1()) -(DEFUN |npDefaultDecl| () - (PROG NIL - (RETURN - (AND - (|npEqKey| (QUOTE COLON)) - (OR (|npType|) (|npTrap|)) - (|npPush| (|pfSpread| (|pfParts| (|npPop2|)) (|npPop1|))))))) - -;npDefaultItem()==npTypeVariable() and (npDefaultDecl() or npTrap()) -(DEFUN |npDefaultItem| () - (PROG NIL - (RETURN - (AND - (|npTypeVariable|) - (OR (|npDefaultDecl|) (|npTrap|)))))) - -;npSDefaultItem()== npListing function npDefaultItem -; and npPush pfAppend pfParts npPop1() -(DEFUN |npSDefaultItem| () - (PROG NIL - (RETURN - (AND - (|npListing| (FUNCTION |npDefaultItem|)) - (|npPush| (|pfAppend| (|pfParts| (|npPop1|)))))))) - -;npDef()== -; npMatch() => -; [op,arg,rt]:= pfCheckItOut(npPop1()) -; npDefTail() or npTrap() -; body:=npPop1() -; null arg => npPush pfDefinition (op,body) -; npPush pfDefinition (op,pfPushBody(rt,arg,body)) -; false - -;npMdef()== -; npQuiver() => -; [op,arg]:= pfCheckMacroOut(npPop1()) -; npDefTail() or npTrap() -; body:=npPop1() -; null arg => npPush pfMacro (op,body) -; npPush pfMacro (op,pfPushMacroBody(arg,body)) -; false -(DEFUN |npMdef| () - (PROG (|body| |arg| |op| |LETTMP#1|) - (RETURN - (COND - ((|npQuiver|) - (PROGN - (SETQ |LETTMP#1| (|pfCheckMacroOut| (|npPop1|))) - (SETQ |op| (CAR |LETTMP#1|)) - (SETQ |arg| (CADR |LETTMP#1|)) - (OR (|npDefTail|) (|npTrap|)) - (SETQ |body| (|npPop1|)) - (COND - ((NULL |arg|) - (|npPush| (|pfMacro| |op| |body|))) - (#0=(QUOTE T) - (|npPush| (|pfMacro| |op| (|pfPushMacroBody| |arg| |body|))))))) - (#0# NIL))))) +(trace |npAssignVariablelist|) @ \eject diff --git a/src/interp/ptrees.lisp.pamphlet b/src/interp/ptrees.lisp.pamphlet index f79918c..290c60a 100644 --- a/src/interp/ptrees.lisp.pamphlet +++ b/src/interp/ptrees.lisp.pamphlet @@ -55,11 +55,6 @@ (DEFUN |pfLoop1| (|body|) (PROG () (RETURN (|pfLoop| (|pfListOf| (LIST (|pfDo| |body|))))))) -;pfReturnNoName(value)==pfReturn(value,pfNothing()) - -(DEFUN |pfReturnNoName| (|value|) - (PROG () (RETURN (|pfReturn| |value| (|pfNothing|))))) - ;--The rest have been generated from ABCUT INPUT ;-- 1/31/89 ; @@ -114,40 +109,6 @@ (PROG () (RETURN (|pfTree| '|WDeclare| (LIST |pfsignature| |pfdoc|))))) -;-- Tagged := (Tag: Expr, Expr: Expr) - -;pfTagged(pftag, pfexpr) == pfTree('Tagged, [pftag, pfexpr]) - -(DEFUN |pfTagged| (|pftag| |pfexpr|) - (PROG () (RETURN (|pfTree| '|Tagged| (LIST |pftag| |pfexpr|))))) - -;-- Pretend := (Expr: Expr, Type: Type) - -;pfPretend(pfexpr, pftype) == pfTree('Pretend, [pfexpr, pftype]) - -(DEFUN |pfPretend| (|pfexpr| |pftype|) - (PROG () (RETURN (|pfTree| '|Pretend| (LIST |pfexpr| |pftype|))))) - - -;-- Restrict := (Expr: Expr, Type: Type) - -;pfRestrict(pfexpr, pftype) == pfTree('Restrict, [pfexpr, pftype]) - -(DEFUN |pfRestrict| (|pfexpr| |pftype|) - (PROG () (RETURN (|pfTree| '|Restrict| (LIST |pfexpr| |pftype|))))) - -;pfRetractTo(pfexpr, pftype) == pfTree('RetractTo, [pfexpr, pftype]) - -(DEFUN |pfRetractTo| (|pfexpr| |pftype|) - (PROG () (RETURN (|pfTree| '|RetractTo| (LIST |pfexpr| |pftype|))))) - -;-- Coerceto := (Expr: Expr, Type: Type) - -;pfCoerceto(pfexpr, pftype) == pfTree('Coerceto, [pfexpr, pftype]) - -(DEFUN |pfCoerceto| (|pfexpr| |pftype|) - (PROG () (RETURN (|pfTree| '|Coerceto| (LIST |pfexpr| |pftype|))))) - ;-- MLambda := (Args: [Id], Body: Expr) ;pfMLambda(pfargs, pfbody) == pfTree('MLambda, [pfargs, pfbody]) @@ -183,20 +144,6 @@ (PROG () (RETURN (|pfTree| '|Collect| (LIST |pfbody| |pfiterators|))))) -;-- Forin := (Lhs: [AssLhs], Whole: Expr) - -;pfForin(pflhs, pfwhole) == pfTree('Forin, [pflhs, pfwhole]) - -(DEFUN |pfForin| (|pflhs| |pfwhole|) - (PROG () (RETURN (|pfTree| '|Forin| (LIST |pflhs| |pfwhole|))))) - -;-- While := (Cond: Expr) - -;pfWhile(pfcond) == pfTree('While, [pfcond]) - -(DEFUN |pfWhile| (|pfcond|) - (PROG () (RETURN (|pfTree| '|While| (LIST |pfcond|))))) - ;-- Suchthat := (Cond: Expr) ;pfSuchthat(pfcond) == pfTree('Suchthat, [pfcond]) @@ -211,27 +158,6 @@ (DEFUN |pfDo| (|pfbody|) (PROG () (RETURN (|pfTree| '|Do| (LIST |pfbody|))))) -;-- Iterate := (From: ? Id) - -;pfIterate(pffrom) == pfTree('Iterate, [pffrom]) - -(DEFUN |pfIterate| (|pffrom|) - (PROG () (RETURN (|pfTree| '|Iterate| (LIST |pffrom|))))) - -;-- Break := (From: ? Id) - -;pfBreak(pffrom) == pfTree('Break, [pffrom]) - -(DEFUN |pfBreak| (|pffrom|) - (PROG () (RETURN (|pfTree| '|Break| (LIST |pffrom|))))) - -;-- Return := (Expr: ? Expr, From: ? Id) - -;pfReturn(pfexpr, pffrom) == pfTree('Return, [pfexpr, pffrom]) - -(DEFUN |pfReturn| (|pfexpr| |pffrom|) - (PROG () (RETURN (|pfTree| '|Return| (LIST |pfexpr| |pffrom|))))) - ;-- Macro := (Lhs: Id, Rhs: ExprorNot) ;pfMacro(pflhs, pfrhs) == pfTree('Macro, [pflhs, pfrhs]) @@ -261,13 +187,6 @@ (DEFUN |pfTyping| (|pfitems|) (PROG () (RETURN (|pfTree| '|Typing| (LIST |pfitems|))))) -;-- Export := (Items: [Typed]) - -;pfExport(pfitems) == pfTree('Export, [pfitems]) - -(DEFUN |pfExport| (|pfitems|) - (PROG () (RETURN (|pfTree| '|Export| (LIST |pfitems|))))) - ;-- Local := (Items: [Typed]) ;pfLocal(pfitems) == pfTree('Local, [pfitems]) @@ -275,13 +194,6 @@ (DEFUN |pfLocal| (|pfitems|) (PROG () (RETURN (|pfTree| '|Local| (LIST |pfitems|))))) -;-- Free := (Items: [Typed]) - -;pfFree(pfitems) == pfTree('Free, [pfitems]) - -(DEFUN |pfFree| (|pfitems|) - (PROG () (RETURN (|pfTree| '|Free| (LIST |pfitems|))))) - ;-- Import := (Items: [QualType]) ;pfImport(pfitems) == pfTree('Import, [pfitems]) @@ -289,20 +201,6 @@ (DEFUN |pfImport| (|pfitems|) (PROG () (RETURN (|pfTree| '|Import| (LIST |pfitems|))))) -;-- Inline := (Items: [QualType]) - -;pfInline(pfitems) == pfTree('Inline, [pfitems]) - -(DEFUN |pfInline| (|pfitems|) - (PROG () (RETURN (|pfTree| '|Inline| (LIST |pfitems|))))) - -;-- QualType := (Type: Type, Qual: ? Type) - -;pfQualType(pftype, pfqual) == pfTree('QualType, [pftype, pfqual]) - -(DEFUN |pfQualType| (|pftype| |pfqual|) - (PROG () (RETURN (|pfTree| '|QualType| (LIST |pftype| |pfqual|))))) - ;pfCheckMacroOut form == ; pfId? form => [form,nil] ; pfApplication? form =>