diff options
author | dos-reis <gdr@axiomatics.org> | 2012-01-09 13:24:42 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2012-01-09 13:24:42 +0000 |
commit | acd15b16070d5272387459a4d764577be01d3577 (patch) | |
tree | be1c1b8020dae74628ba70eb82a8f9892a9c6021 /src/boot | |
parent | c95f1b3efced12df21e9e99369cdb1a0a7d8ec2d (diff) | |
download | open-axiom-acd15b16070d5272387459a4d764577be01d3577.tar.gz |
* boot/parser.boot (bpRequire): New. Use it throughout this module.
Diffstat (limited to 'src/boot')
-rw-r--r-- | src/boot/parser.boot | 147 | ||||
-rw-r--r-- | src/boot/strap/parser.clisp | 158 |
2 files changed, 150 insertions, 155 deletions
diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 5c198129..3aee7371 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -78,8 +78,12 @@ bpNextToken() == $inputStream := rest($inputStream) bpFirstToken() -bpState()== [$inputStream,$stack,$bpParenCount,$bpCount] ---[$inputStream,:$stack] +bpRequire f == + apply(f,nil) or bpTrap() + +bpState() == + [$inputStream,$stack,$bpParenCount,$bpCount] + bpRestore(x)== $inputStream:=first x @@ -163,10 +167,10 @@ bpPileBracketed f== bpListof(f,str1,g)== apply(f,nil) => - bpEqKey str1 and (apply(f,nil) or bpTrap()) => + bpEqKey str1 and bpRequire f => a:=$stack $stack:=nil - while bpEqKey str1 and (apply(f,nil) or bpTrap()) repeat 0 + while bpEqKey str1 and bpRequire f repeat 0 $stack:=[reverse! $stack,:a] bpPush FUNCALL(g, [bpPop3(),bpPop2(),:bpPop1()]) true @@ -176,10 +180,10 @@ bpListof(f,str1,g)== -- to do ,<backset> bpListofFun(f,h,g)== apply(f,nil) => - apply(h,nil) and (apply(f,nil) or bpTrap()) => + apply(h,nil) and bpRequire f => a:=$stack $stack:=nil - while apply(h,nil) and (apply(f,nil) or bpTrap()) repeat 0 + while apply(h,nil) and bpRequire f repeat 0 $stack:=[reverse! $stack,:a] bpPush FUNCALL(g, [bpPop3(),bpPop2(),:bpPop1()]) true @@ -187,10 +191,10 @@ bpListofFun(f,h,g)== bpList(f,str1)== apply(f,nil) => - bpEqKey str1 and (apply(f,nil) or bpTrap()) => + bpEqKey str1 and bpRequire f => a:=$stack $stack:=nil - while bpEqKey str1 and (apply(f,nil) or bpTrap()) repeat 0 + while bpEqKey str1 and bpRequire f repeat 0 $stack:=[reverse! $stack,:a] bpPush [bpPop3(),bpPop2(),:bpPop1()] bpPush [bpPop1()] @@ -214,23 +218,23 @@ bpAnyNo s== -- AndOr(k,p,f)= k p bpAndOr(keyword,p,f)== - bpEqKey keyword and (apply(p,nil) or bpTrap()) + bpEqKey keyword and bpRequire p and bpPush FUNCALL(f, bpPop1()) bpConditional f== - bpEqKey "IF" and (bpWhere() or bpTrap()) and (bpEqKey "BACKSET" or true) => + bpEqKey "IF" and bpRequire function bpWhere and (bpEqKey "BACKSET" or true) => bpEqKey "SETTAB" => bpEqKey "THEN" => - (apply(f,nil) or bpTrap()) and bpElse(f) and bpEqKey "BACKTAB" + bpRequire f and bpElse(f) and bpEqKey "BACKTAB" bpMissing "THEN" - bpEqKey "THEN" => (apply(f,nil) or bpTrap()) and bpElse(f) + bpEqKey "THEN" => bpRequire f and bpElse(f) bpMissing "then" false bpElse(f)== a:=bpState() bpBacksetElse() => - (apply(f,nil) or bpTrap()) and + bpRequire f and bpPush bfIf(bpPop3(),bpPop2(),bpPop1()) bpRestore a bpPush bfIfThenOnly(bpPop2(),bpPop1()) @@ -379,8 +383,8 @@ bpConstTok() == $stok is ["LINE",:.] => bpPush ["+LINE", $ttok] and bpNext() bpEqPeek "QUOTE" => bpNext() - (bpSexp() or bpTrap()) and - bpPush bfSymbol bpPop1() + bpRequire function bpSexp and + bpPush bfSymbol bpPop1() bpString() bpChar() == @@ -396,7 +400,7 @@ bpChar() == ++ Subroutine of bpExportItem. Parses tails of ExportItem. bpExportItemTail() == - bpEqKey "BEC" and (bpAssign() or bpTrap()) and + bpEqKey "BEC" and bpRequire function bpAssign and bpPush %Assignment(bpPop2(), bpPop1()) or bpSimpleDefinitionTail() @@ -412,7 +416,7 @@ bpExportItem() == bpName() => bpEqPeek "COLON" => bpRestore a - bpSignature() or bpTrap() + bpRequire function bpSignature bpExportItemTail() or true bpRestore a bpTypeAliasDefition() @@ -444,7 +448,7 @@ bpModuleExports() == ++ MODULE Name OptionalModuleExports OptionalModuleInterface bpModule() == bpEqKey "MODULE" => - bpName() or bpTrap() + bpRequire function bpName bpModuleExports() bpModuleInterface() bpPush %Module(bpPop3(),bpPop2(),bpPop1()) @@ -462,12 +466,12 @@ bpImport() == bpPush %Import bfNamespace bpPop1() or bpTrap() a := bpState() - bpName() or bpTrap() + bpRequire function bpName bpEqPeek "COLON" => bpRestore a - (bpSignature() or bpTrap()) and + bpRequire function bpSignature and (bpEqKey "FOR" or bpTrap()) and - (bpName() or bpTrap()) and + bpRequire function bpName and bpPush %ImportSignature(bpPop1(), bpPop1()) bpPush %Import bpPop1() false @@ -499,7 +503,7 @@ bpSignature() == ++ Application -> Application bpSimpleMapping() == bpApplication() => - bpEqKey "ARROW" and (bpApplication() or bpTrap()) and + bpEqKey "ARROW" and bpRequire function bpApplication and bpPush %Mapping(bpPop1(), [bpPop1()]) true false @@ -560,7 +564,7 @@ bpAnyId()== bpSexp()== bpAnyId() or - bpEqKey "QUOTE" and (bpSexp() or bpTrap()) + bpEqKey "QUOTE" and bpRequire function bpSexp and bpPush bfSymbol bpPop1() or bpIndentParenthesized function bpSexp1 @@ -616,9 +620,9 @@ bpApplication()== ++ FORALL Variable DOT Typing bpTyping() == bpEqKey "FORALL" => - bpVariable() or bpTrap() + bpRequire function bpVariable (bpDot() and bpPop1()) or bpTrap() - bpTyping() or bpTrap() + bpRequire function bpTyping bpPush %Forall(bpPop2(), bpPop1()) bpMapping() or bpSimpleMapping() @@ -626,7 +630,7 @@ bpTyping() == ++ Name : Typing bpTagged()== bpApplication() and - (bpEqKey "COLON" and (bpTyping() or bpTrap()) and + (bpEqKey "COLON" and bpRequire function bpTyping and bpPush bfTagged(bpPop2(),bpPop1()) or true) bpExpt()== bpRightAssoc('(POWER),function bpTagged) @@ -649,7 +653,7 @@ bpRightAssoc(o,p)== bpLeftAssoc(operations,parser)== apply(parser,nil) => - while bpInfGeneric(operations) and (apply(parser,nil) or bpTrap()) + while bpInfGeneric(operations) and bpRequire parser repeat bpPush bfInfApplication(bpPop2(),bpPop2(),bpPop1()) true @@ -672,9 +676,9 @@ bpReduce()== a := bpState() bpReduceOperator() and bpEqKey "SLASH" => bpEqPeek "OBRACK" => - (bpDConstruct() or bpTrap()) and + bpRequire function bpDConstruct and bpPush bfReduceCollect(bpPop2(),bpPop1()) - (bpApplication() or bpTrap()) and + bpRequire function bpApplication and bpPush bfReduce(bpPop2(),bpPop1()) bpRestore a false @@ -686,7 +690,7 @@ bpEuclid() == bpLeftAssoc('(QUO REM),function bpTimes) bpMinus()== - bpInfGeneric '(MINUS) and (bpEuclid() or bpTrap()) + bpInfGeneric '(MINUS) and bpRequire function bpEuclid and bpPush(bfApplication(bpPop2(),bpPop1())) or bpEuclid() @@ -694,9 +698,9 @@ bpArith()==bpLeftAssoc('(PLUS MINUS),function bpMinus) bpIs()== bpArith() and - bpInfKey '(IS ISNT) and (bpPattern() or bpTrap()) => + bpInfKey '(IS ISNT) and bpRequire function bpPattern => bpPush bfISApplication(bpPop2(),bpPop2(),bpPop1()) - bpEqKey "HAS" and (bpApplication() or bpTrap()) => + bpEqKey "HAS" and bpRequire function bpApplication => bpPush bfHas(bpPop2(), bpPop1()) true @@ -705,7 +709,7 @@ bpBracketConstruct(f)== bpCompare()== bpIs() and (bpInfKey '(SHOEEQ SHOENE LT LE GT GE IN) - and (bpIs() or bpTrap()) + and bpRequire function bpIs and bpPush bfInfApplication(bpPop2(),bpPop2(),bpPop1()) or true) or bpLeave() @@ -718,7 +722,7 @@ bpThrow() == bpEqKey "THROW" and bpApplication() => -- Allow user-supplied matching type tag if bpEqKey "COLON" then - bpApplication() or bpTrap() + bpRequire function bpApplication bpPush %Pretend(bpPop2(),bpPop1()) bpPush bfThrow bpPop1() nil @@ -740,20 +744,20 @@ bpTry() == nil bpCatchItem() == - (bpExceptionVariable() or bpTrap()) and + bpRequire function bpExceptionVariable and (bpEqKey "EXIT" or bpTrap()) and - (bpAssign() or bpTrap()) and + bpRequire function bpAssign and bpPush %Catch(bpPop2(),bpPop1()) bpExceptionVariable() == t := $stok bpEqKey "OPAREN" and - (bpSignature() or bpTrap()) and + bpRequire function bpSignature and (bpEqKey "CPAREN" or bpMissing t) or bpTrap() bpFinally() == - (bpAssign() or bpTrap()) and + bpRequire function bpAssign and bpPush %Finally bpPop1() bpHandler key == @@ -765,7 +769,7 @@ bpHandler key == ++ Leave: ++ LEAVE Logical bpLeave() == - bpEqKey "LEAVE" and (bpLogical() or bpTrap()) and + bpEqKey "LEAVE" and bpRequire function bpLogical and bpPush bfLeave bpPop1() ++ Do: @@ -773,10 +777,11 @@ bpLeave() == ++ DO Assign bpDo() == bpEqKey "IN" => - bpNamespace() or bpTrap() - bpDo() or bpTrap() + bpRequire function bpNamespace + bpRequire function bpDo bpPush bfAtScope(bpPop2(),bpPop1()) - bpEqKey "DO" and (bpAssign() or bpTrap()) and bpPush bfDo bpPop1() + bpEqKey "DO" and bpRequire function bpAssign and + bpPush bfDo bpPop1() ++ Return: ++ RETURN Assign @@ -784,7 +789,7 @@ bpDo() == ++ Throw ++ And bpReturn()== - (bpEqKey "RETURN" and (bpAssign() or bpTrap()) and + (bpEqKey "RETURN" and bpRequire function bpAssign and bpPush bfReturnNoName bpPop1()) or bpLeave() or bpThrow() @@ -807,10 +812,10 @@ bpStatement()== bpLoop()== bpIterators() and (bpCompMissing "REPEAT" and - (bpWhere() or bpTrap()) and + bpRequire function bpWhere and bpPush bfLp(bpPop2(),bpPop1())) or - bpEqKey "REPEAT" and (bpLogical() or bpTrap()) and + bpEqKey "REPEAT" and bpRequire function bpLogical and bpPush bfLoop1 bpPop1 () bpSuchThat()==bpAndOr("BAR",function bpWhere,function bfSuchthat) @@ -823,9 +828,9 @@ bpFormal() == bpVariable() or bpDot() bpForIn()== - bpEqKey "FOR" and (bpFormal() or bpTrap()) and (bpCompMissing "IN") - and ((bpSeg() or bpTrap()) and - (bpEqKey "BY" and (bpArith() or bpTrap()) and + bpEqKey "FOR" and bpRequire function bpFormal and (bpCompMissing "IN") + and (bpRequire function bpSeg and + (bpEqKey "BY" and bpRequire function bpArith and bpPush bfForInBy(bpPop3(),bpPop2(),bpPop1())) or bpPush bfForin(bpPop2(),bpPop1())) @@ -854,13 +859,13 @@ bpAssign()== bpStatement() => bpEqPeek "BEC" => bpRestore a - bpAssignment() or bpTrap() + bpRequire function bpAssignment bpEqPeek "GIVES" => bpRestore a - bpLambda() or bpTrap() + bpRequire function bpLambda bpEqPeek "LARROW" => bpRestore a - bpKeyArg() or bpTrap() + bpRequire function bpKeyArg true bpRestore a false @@ -868,7 +873,7 @@ bpAssign()== bpAssignment()== bpAssignVariable() and bpEqKey "BEC" and - (bpAssign() or bpTrap()) and + bpRequire function bpAssign and bpPush bfAssign (bpPop2(),bpPop1()) ++ Parse a lambda expression @@ -876,7 +881,7 @@ bpAssignment()== bpLambda() == bpVariable() and bpEqKey "GIVES" and - (bpAssign() or bpTrap()) and + bpRequire function bpAssign and bpPush bfLambda(bpPop2(),bpPop1()) bpKeyArg() == @@ -886,7 +891,7 @@ bpKeyArg() == -- should only be allowed in sequences bpExit()== bpAssign() and (bpEqKey "EXIT" and - ((bpWhere() or bpTrap()) and + (bpRequire function bpWhere and bpPush bfExit (bpPop2(),bpPop1())) or true) @@ -921,13 +926,13 @@ bpDDef() == bpName() and bpDefTail function %Definition ++ Parse the remaining of a simple definition. bpSimpleDefinitionTail() == bpEqKey "DEF" and - (bpWhere() or bpTrap()) + bpRequire function bpWhere and bpPush %ConstantDefinition(bpPop2(), bpPop1()) ++ Parse the remaining of a compound definition. bpCompoundDefinitionTail f == bpVariable() and - bpEqKey "DEF" and (bpWhere() or bpTrap()) and + bpEqKey "DEF" and bpRequire function bpWhere and bpPush apply(f,[bpPop3(),bpPop2(),bpPop1()]) @@ -940,7 +945,7 @@ bpDefTail f == bpWhere()== bpDefinition() and - (bpEqKey "WHERE" and (bpDefinitionItem() or bpTrap()) + (bpEqKey "WHERE" and bpRequire function bpDefinitionItem and bpPush bfWhere(bpPop1(),bpPop1()) or true) bpDefinitionItem()== @@ -1031,7 +1036,7 @@ bpRegularPatternItem() == bpEqual() or bpConstTok() or bpDot() or bpName() and - ((bpEqKey "BEC" and (bpPattern() or bpTrap()) + ((bpEqKey "BEC" and bpRequire function bpPattern and bpPush bfAssign(bpPop2(),bpPop1())) or true) or bpBracketConstruct function bpPatternL @@ -1042,7 +1047,7 @@ bpRegularList()== bpListof(function bpRegularPatternItemL,"COMMA",function bfAppend) bpPatternColon()== - bpEqKey "COLON" and (bpRegularPatternItem() or bpTrap()) + bpEqKey "COLON" and bpRequire function bpRegularPatternItem and bpPush [bfColon bpPop1()] @@ -1061,7 +1066,7 @@ bpPatternList()== bpPatternTail()== bpPatternColon() and - (bpEqKey "COMMA" and (bpRegularList() or bpTrap()) + (bpEqKey "COMMA" and bpRequire function bpRegularList and bpPush append (bpPop2(),bpPop1()) or true) -- BOUND VARIABLE @@ -1072,13 +1077,13 @@ bpPatternTail()== ++ a form with a specific pattern structure, or whether it has ++ a default value. bpRegularBVItemTail() == - bpEqKey "COLON" and (bpApplication() or bpTrap()) and + bpEqKey "COLON" and bpRequire function bpApplication and bpPush bfTagged(bpPop2(), bpPop1()) - or bpEqKey "BEC" and (bpPattern() or bpTrap()) and + or bpEqKey "BEC" and bpRequire function bpPattern and bpPush bfAssign(bpPop2(),bpPop1()) - or bpEqKey "IS" and (bpPattern() or bpTrap()) and + or bpEqKey "IS" and bpRequire function bpPattern and bpPush bfAssign(bpPop2(),bpPop1()) - or bpEqKey "DEF" and (bpApplication() or bpTrap()) and + or bpEqKey "DEF" and bpRequire function bpApplication and bpPush %DefaultValue(bpPop2(), bpPop1()) @@ -1123,7 +1128,7 @@ bpAssignVariable()== bpAssignLHS()== not bpName() => false bpEqKey "COLON" => -- variable declaration - bpApplication() or bpTrap() + bpRequire function bpApplication bpPush bfLocal(bpPop2(),bpPop1()) bpArgumentList() and (bpEqPeek "DOT" @@ -1142,13 +1147,13 @@ bpChecknull()== bpStruct()== bpEqKey "STRUCTURE" and - (bpName() or bpTrap()) and + bpRequire function bpName and (bpEqKey "DEF" or bpTrap()) and bpTypeList() and bpPush %Structure(bpPop2(),bpPop1()) bpTypeList() == bpPileBracketed function bpTypeItemList - or bpTerm function bpIdList and bpPush [bpPop1()] + or bpTypeItem() and bpPush [bpPop1()] bpTypeItem() == bpTerm function bpIdList @@ -1157,7 +1162,7 @@ bpTypeItemList() == bpListAndRecover function bpTypeItem bpTerm idListParser == - (bpName() or bpTrap()) and + bpRequire function bpName and ((bpParenthesized idListParser and bpPush bfNameArgs (bpPop2(),bpPop1())) or bpName() and bpPush bfNameArgs(bpPop2(),bpPop1())) @@ -1168,7 +1173,7 @@ bpIdList()== bpCase()== bpEqKey "CASE" and - (bpWhere() or bpTrap()) and + bpRequire function bpWhere and (bpEqKey "OF" or bpMissing "OF") and bpPiledCaseItems() @@ -1188,7 +1193,7 @@ bpCasePatternVarList() == bpCaseItem()== (bpTerm function bpCasePatternVarList or bpTrap()) and (bpEqKey "EXIT" or bpTrap()) and - (bpWhere() or bpTrap()) and + bpRequire function bpWhere and bpPush bfCaseItem (bpPop2(),bpPop1()) @@ -1196,7 +1201,7 @@ bpCaseItem()== bpOutItem()== $op: local := nil $GenVarCounter: local := 0 - bpComma() or bpTrap() + bpRequire function bpComma b := bpPop1() bpPush b is ["+LINE",:.] => [ b ] diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index f8417b34..34fff72f 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -45,6 +45,8 @@ (DECLARE (SPECIAL |$inputStream|)) (PROGN (SETQ |$inputStream| (CDR |$inputStream|)) (|bpFirstToken|))) +(DEFUN |bpRequire| (|f|) (OR (APPLY |f| NIL) (|bpTrap|))) + (DEFUN |bpState| () (DECLARE (SPECIAL |$inputStream| |$stack| |$bpParenCount| |$bpCount|)) (LIST |$inputStream| |$stack| |$bpParenCount| |$bpCount|)) @@ -157,13 +159,11 @@ (COND ((APPLY |f| NIL) (COND - ((AND (|bpEqKey| |str1|) (OR (APPLY |f| NIL) (|bpTrap|))) - (SETQ |a| |$stack|) (SETQ |$stack| NIL) + ((AND (|bpEqKey| |str1|) (|bpRequire| |f|)) (SETQ |a| |$stack|) + (SETQ |$stack| NIL) (LOOP - (COND - ((NOT (AND (|bpEqKey| |str1|) (OR (APPLY |f| NIL) (|bpTrap|)))) - (RETURN NIL)) - (T 0))) + (COND ((NOT (AND (|bpEqKey| |str1|) (|bpRequire| |f|))) (RETURN NIL)) + (T 0))) (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (FUNCALL |g| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|)))))) @@ -177,13 +177,11 @@ (COND ((APPLY |f| NIL) (COND - ((AND (APPLY |h| NIL) (OR (APPLY |f| NIL) (|bpTrap|))) - (SETQ |a| |$stack|) (SETQ |$stack| NIL) + ((AND (APPLY |h| NIL) (|bpRequire| |f|)) (SETQ |a| |$stack|) + (SETQ |$stack| NIL) (LOOP - (COND - ((NOT (AND (APPLY |h| NIL) (OR (APPLY |f| NIL) (|bpTrap|)))) - (RETURN NIL)) - (T 0))) + (COND ((NOT (AND (APPLY |h| NIL) (|bpRequire| |f|))) (RETURN NIL)) + (T 0))) (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (FUNCALL |g| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|)))))) @@ -197,13 +195,11 @@ (COND ((APPLY |f| NIL) (COND - ((AND (|bpEqKey| |str1|) (OR (APPLY |f| NIL) (|bpTrap|))) - (SETQ |a| |$stack|) (SETQ |$stack| NIL) + ((AND (|bpEqKey| |str1|) (|bpRequire| |f|)) (SETQ |a| |$stack|) + (SETQ |$stack| NIL) (LOOP - (COND - ((NOT (AND (|bpEqKey| |str1|) (OR (APPLY |f| NIL) (|bpTrap|)))) - (RETURN NIL)) - (T 0))) + (COND ((NOT (AND (|bpEqKey| |str1|) (|bpRequire| |f|))) (RETURN NIL)) + (T 0))) (SETQ |$stack| (CONS (|reverse!| |$stack|) |a|)) (|bpPush| (CONS (|bpPop3|) (CONS (|bpPop2|) (|bpPop1|))))) (T (|bpPush| (LIST (|bpPop1|)))))) @@ -224,21 +220,19 @@ (PROGN (LOOP (COND ((NOT (APPLY |s| NIL)) (RETURN NIL)) (T 0))) T)) (DEFUN |bpAndOr| (|keyword| |p| |f|) - (AND (|bpEqKey| |keyword|) (OR (APPLY |p| NIL) (|bpTrap|)) + (AND (|bpEqKey| |keyword|) (|bpRequire| |p|) (|bpPush| (FUNCALL |f| (|bpPop1|))))) (DEFUN |bpConditional| (|f|) (COND - ((AND (|bpEqKey| 'IF) (OR (|bpWhere|) (|bpTrap|)) - (OR (|bpEqKey| 'BACKSET) T)) + ((AND (|bpEqKey| 'IF) (|bpRequire| #'|bpWhere|) (OR (|bpEqKey| 'BACKSET) T)) (COND ((|bpEqKey| 'SETTAB) (COND ((|bpEqKey| 'THEN) - (AND (OR (APPLY |f| NIL) (|bpTrap|)) (|bpElse| |f|) - (|bpEqKey| 'BACKTAB))) + (AND (|bpRequire| |f|) (|bpElse| |f|) (|bpEqKey| 'BACKTAB))) (T (|bpMissing| 'THEN)))) - ((|bpEqKey| 'THEN) (AND (OR (APPLY |f| NIL) (|bpTrap|)) (|bpElse| |f|))) + ((|bpEqKey| 'THEN) (AND (|bpRequire| |f|) (|bpElse| |f|))) (T (|bpMissing| '|then|)))) (T NIL))) @@ -249,7 +243,7 @@ (SETQ |a| (|bpState|)) (COND ((|bpBacksetElse|) - (AND (OR (APPLY |f| NIL) (|bpTrap|)) + (AND (|bpRequire| |f|) (|bpPush| (|bfIf| (|bpPop3|) (|bpPop2|) (|bpPop1|))))) (T (|bpRestore| |a|) (|bpPush| (|bfIfThenOnly| (|bpPop2|) (|bpPop1|))))))))) @@ -393,7 +387,7 @@ ((AND (CONSP |$stok|) (EQ (CAR |$stok|) 'LINE)) (AND (|bpPush| (LIST '+LINE |$ttok|)) (|bpNext|))) ((|bpEqPeek| 'QUOTE) (|bpNext|) - (AND (OR (|bpSexp|) (|bpTrap|)) (|bpPush| (|bfSymbol| (|bpPop1|))))) + (AND (|bpRequire| #'|bpSexp|) (|bpPush| (|bfSymbol| (|bpPop1|))))) (T (|bpString|)))) (DEFUN |bpChar| () @@ -417,7 +411,7 @@ (DEFUN |bpExportItemTail| () (OR - (AND (|bpEqKey| 'BEC) (OR (|bpAssign|) (|bpTrap|)) + (AND (|bpEqKey| 'BEC) (|bpRequire| #'|bpAssign|) (|bpPush| (|%Assignment| (|bpPop2|) (|bpPop1|)))) (|bpSimpleDefinitionTail|))) @@ -430,7 +424,7 @@ ((|bpName|) (COND ((|bpEqPeek| 'COLON) (|bpRestore| |a|) - (OR (|bpSignature|) (|bpTrap|)) (OR (|bpExportItemTail|) T)) + (|bpRequire| #'|bpSignature|) (OR (|bpExportItemTail|) T)) (T (|bpRestore| |a|) (|bpTypeAliasDefition|)))) (T NIL))))))) @@ -449,7 +443,7 @@ (DEFUN |bpModule| () (COND - ((|bpEqKey| 'MODULE) (OR (|bpName|) (|bpTrap|)) (|bpModuleExports|) + ((|bpEqKey| 'MODULE) (|bpRequire| #'|bpName|) (|bpModuleExports|) (|bpModuleInterface|) (|bpPush| (|%Module| (|bpPop3|) (|bpPop2|) (|bpPop1|)))) (T NIL))) @@ -465,11 +459,11 @@ (AND (|bpLeftAssoc| '(DOT) #'|bpName|) (|bpPush| (|%Import| (|bfNamespace| (|bpPop1|))))) (|bpTrap|))) - (T (SETQ |a| (|bpState|)) (OR (|bpName|) (|bpTrap|)) + (T (SETQ |a| (|bpState|)) (|bpRequire| #'|bpName|) (COND ((|bpEqPeek| 'COLON) (|bpRestore| |a|) - (AND (OR (|bpSignature|) (|bpTrap|)) - (OR (|bpEqKey| 'FOR) (|bpTrap|)) (OR (|bpName|) (|bpTrap|)) + (AND (|bpRequire| #'|bpSignature|) (OR (|bpEqKey| 'FOR) (|bpTrap|)) + (|bpRequire| #'|bpName|) (|bpPush| (|%ImportSignature| (|bpPop1|) (|bpPop1|))))) (T (|bpPush| (|%Import| (|bpPop1|)))))))) (T NIL))))) @@ -489,7 +483,7 @@ (DEFUN |bpSimpleMapping| () (COND ((|bpApplication|) - (AND (|bpEqKey| 'ARROW) (OR (|bpApplication|) (|bpTrap|)) + (AND (|bpEqKey| 'ARROW) (|bpRequire| #'|bpApplication|) (|bpPush| (|%Mapping| (|bpPop1|) (LIST (|bpPop1|))))) T) (T NIL))) @@ -552,7 +546,7 @@ (DEFUN |bpSexp| () (OR (|bpAnyId|) - (AND (|bpEqKey| 'QUOTE) (OR (|bpSexp|) (|bpTrap|)) + (AND (|bpEqKey| 'QUOTE) (|bpRequire| #'|bpSexp|) (|bpPush| (|bfSymbol| (|bpPop1|)))) (|bpIndentParenthesized| #'|bpSexp1|))) @@ -606,15 +600,15 @@ (DEFUN |bpTyping| () (COND - ((|bpEqKey| 'FORALL) (OR (|bpVariable|) (|bpTrap|)) - (OR (AND (|bpDot|) (|bpPop1|)) (|bpTrap|)) (OR (|bpTyping|) (|bpTrap|)) + ((|bpEqKey| 'FORALL) (|bpRequire| #'|bpVariable|) + (OR (AND (|bpDot|) (|bpPop1|)) (|bpTrap|)) (|bpRequire| #'|bpTyping|) (|bpPush| (|%Forall| (|bpPop2|) (|bpPop1|)))) (T (OR (|bpMapping|) (|bpSimpleMapping|))))) (DEFUN |bpTagged| () (AND (|bpApplication|) (OR - (AND (|bpEqKey| 'COLON) (OR (|bpTyping|) (|bpTrap|)) + (AND (|bpEqKey| 'COLON) (|bpRequire| #'|bpTyping|) (|bpPush| (|bfTagged| (|bpPop2|) (|bpPop1|)))) T))) @@ -650,9 +644,7 @@ ((APPLY |parser| NIL) (LOOP (COND - ((NOT - (AND (|bpInfGeneric| |operations|) - (OR (APPLY |parser| NIL) (|bpTrap|)))) + ((NOT (AND (|bpInfGeneric| |operations|) (|bpRequire| |parser|))) (RETURN NIL)) (T (|bpPush| (|bfInfApplication| (|bpPop2|) (|bpPop2|) (|bpPop1|)))))) T) @@ -682,10 +674,10 @@ ((AND (|bpReduceOperator|) (|bpEqKey| 'SLASH)) (COND ((|bpEqPeek| 'OBRACK) - (AND (OR (|bpDConstruct|) (|bpTrap|)) + (AND (|bpRequire| #'|bpDConstruct|) (|bpPush| (|bfReduceCollect| (|bpPop2|) (|bpPop1|))))) (T - (AND (OR (|bpApplication|) (|bpTrap|)) + (AND (|bpRequire| #'|bpApplication|) (|bpPush| (|bfReduce| (|bpPop2|) (|bpPop1|))))))) (T (|bpRestore| |a|) NIL)))))) @@ -695,7 +687,7 @@ (DEFUN |bpMinus| () (OR - (AND (|bpInfGeneric| '(MINUS)) (OR (|bpEuclid|) (|bpTrap|)) + (AND (|bpInfGeneric| '(MINUS)) (|bpRequire| #'|bpEuclid|) (|bpPush| (|bfApplication| (|bpPop2|) (|bpPop1|)))) (|bpEuclid|))) @@ -704,9 +696,9 @@ (DEFUN |bpIs| () (AND (|bpArith|) (COND - ((AND (|bpInfKey| '(IS ISNT)) (OR (|bpPattern|) (|bpTrap|))) + ((AND (|bpInfKey| '(IS ISNT)) (|bpRequire| #'|bpPattern|)) (|bpPush| (|bfISApplication| (|bpPop2|) (|bpPop2|) (|bpPop1|)))) - ((AND (|bpEqKey| 'HAS) (OR (|bpApplication|) (|bpTrap|))) + ((AND (|bpEqKey| 'HAS) (|bpRequire| #'|bpApplication|)) (|bpPush| (|bfHas| (|bpPop2|) (|bpPop1|)))) (T T)))) @@ -718,7 +710,7 @@ (AND (|bpIs|) (OR (AND (|bpInfKey| '(SHOEEQ SHOENE LT LE GT GE IN)) - (OR (|bpIs|) (|bpTrap|)) + (|bpRequire| #'|bpIs|) (|bpPush| (|bfInfApplication| (|bpPop2|) (|bpPop2|) (|bpPop1|)))) T)) (|bpLeave|) (|bpThrow|))) @@ -729,7 +721,7 @@ (COND ((AND (|bpEqKey| 'THROW) (|bpApplication|)) (COND - ((|bpEqKey| 'COLON) (OR (|bpApplication|) (|bpTrap|)) + ((|bpEqKey| 'COLON) (|bpRequire| #'|bpApplication|) (|bpPush| (|%Pretend| (|bpPop2|) (|bpPop1|))))) (|bpPush| (|bfThrow| (|bpPop1|)))) (T NIL))) @@ -752,9 +744,8 @@ (T NIL))))) (DEFUN |bpCatchItem| () - (AND (OR (|bpExceptionVariable|) (|bpTrap|)) - (OR (|bpEqKey| 'EXIT) (|bpTrap|)) (OR (|bpAssign|) (|bpTrap|)) - (|bpPush| (|%Catch| (|bpPop2|) (|bpPop1|))))) + (AND (|bpRequire| #'|bpExceptionVariable|) (OR (|bpEqKey| 'EXIT) (|bpTrap|)) + (|bpRequire| #'|bpAssign|) (|bpPush| (|%Catch| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpExceptionVariable| () (PROG (|t|) @@ -763,12 +754,12 @@ (PROGN (SETQ |t| |$stok|) (OR - (AND (|bpEqKey| 'OPAREN) (OR (|bpSignature|) (|bpTrap|)) + (AND (|bpEqKey| 'OPAREN) (|bpRequire| #'|bpSignature|) (OR (|bpEqKey| 'CPAREN) (|bpMissing| |t|))) (|bpTrap|)))))) (DEFUN |bpFinally| () - (AND (OR (|bpAssign|) (|bpTrap|)) (|bpPush| (|%Finally| (|bpPop1|))))) + (AND (|bpRequire| #'|bpAssign|) (|bpPush| (|%Finally| (|bpPop1|))))) (DEFUN |bpHandler| (|key|) (PROG (|s|) @@ -782,20 +773,20 @@ (T (|bpRestore| |s|) NIL)))))) (DEFUN |bpLeave| () - (AND (|bpEqKey| 'LEAVE) (OR (|bpLogical|) (|bpTrap|)) + (AND (|bpEqKey| 'LEAVE) (|bpRequire| #'|bpLogical|) (|bpPush| (|bfLeave| (|bpPop1|))))) (DEFUN |bpDo| () (COND - ((|bpEqKey| 'IN) (OR (|bpNamespace|) (|bpTrap|)) (OR (|bpDo|) (|bpTrap|)) + ((|bpEqKey| 'IN) (|bpRequire| #'|bpNamespace|) (|bpRequire| #'|bpDo|) (|bpPush| (|bfAtScope| (|bpPop2|) (|bpPop1|)))) (T - (AND (|bpEqKey| 'DO) (OR (|bpAssign|) (|bpTrap|)) + (AND (|bpEqKey| 'DO) (|bpRequire| #'|bpAssign|) (|bpPush| (|bfDo| (|bpPop1|))))))) (DEFUN |bpReturn| () (OR - (AND (|bpEqKey| 'RETURN) (OR (|bpAssign|) (|bpTrap|)) + (AND (|bpEqKey| 'RETURN) (|bpRequire| #'|bpAssign|) (|bpPush| (|bfReturnNoName| (|bpPop1|)))) (|bpLeave|) (|bpThrow|) (|bpAnd|) (|bpDo|))) @@ -813,9 +804,9 @@ (DEFUN |bpLoop| () (OR - (AND (|bpIterators|) (|bpCompMissing| 'REPEAT) (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpIterators|) (|bpCompMissing| 'REPEAT) (|bpRequire| #'|bpWhere|) (|bpPush| (|bfLp| (|bpPop2|) (|bpPop1|)))) - (AND (|bpEqKey| 'REPEAT) (OR (|bpLogical|) (|bpTrap|)) + (AND (|bpEqKey| 'REPEAT) (|bpRequire| #'|bpLogical|) (|bpPush| (|bfLoop1| (|bpPop1|)))))) (DEFUN |bpSuchThat| () (|bpAndOr| 'BAR #'|bpWhere| #'|bfSuchthat|)) @@ -827,10 +818,9 @@ (DEFUN |bpFormal| () (OR (|bpVariable|) (|bpDot|))) (DEFUN |bpForIn| () - (AND (|bpEqKey| 'FOR) (OR (|bpFormal|) (|bpTrap|)) (|bpCompMissing| 'IN) + (AND (|bpEqKey| 'FOR) (|bpRequire| #'|bpFormal|) (|bpCompMissing| 'IN) (OR - (AND (OR (|bpSeg|) (|bpTrap|)) (|bpEqKey| 'BY) - (OR (|bpArith|) (|bpTrap|)) + (AND (|bpRequire| #'|bpSeg|) (|bpEqKey| 'BY) (|bpRequire| #'|bpArith|) (|bpPush| (|bfForInBy| (|bpPop3|) (|bpPop2|) (|bpPop1|)))) (|bpPush| (|bfForin| (|bpPop2|) (|bpPop1|)))))) @@ -861,18 +851,18 @@ (COND ((|bpStatement|) (COND - ((|bpEqPeek| 'BEC) (|bpRestore| |a|) (OR (|bpAssignment|) (|bpTrap|))) - ((|bpEqPeek| 'GIVES) (|bpRestore| |a|) (OR (|bpLambda|) (|bpTrap|))) - ((|bpEqPeek| 'LARROW) (|bpRestore| |a|) (OR (|bpKeyArg|) (|bpTrap|))) + ((|bpEqPeek| 'BEC) (|bpRestore| |a|) (|bpRequire| #'|bpAssignment|)) + ((|bpEqPeek| 'GIVES) (|bpRestore| |a|) (|bpRequire| #'|bpLambda|)) + ((|bpEqPeek| 'LARROW) (|bpRestore| |a|) (|bpRequire| #'|bpKeyArg|)) (T T))) (T (|bpRestore| |a|) NIL)))))) (DEFUN |bpAssignment| () - (AND (|bpAssignVariable|) (|bpEqKey| 'BEC) (OR (|bpAssign|) (|bpTrap|)) + (AND (|bpAssignVariable|) (|bpEqKey| 'BEC) (|bpRequire| #'|bpAssign|) (|bpPush| (|bfAssign| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpLambda| () - (AND (|bpVariable|) (|bpEqKey| 'GIVES) (OR (|bpAssign|) (|bpTrap|)) + (AND (|bpVariable|) (|bpEqKey| 'GIVES) (|bpRequire| #'|bpAssign|) (|bpPush| (|bfLambda| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpKeyArg| () @@ -882,7 +872,7 @@ (DEFUN |bpExit| () (AND (|bpAssign|) (OR - (AND (|bpEqKey| 'EXIT) (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpEqKey| 'EXIT) (|bpRequire| #'|bpWhere|) (|bpPush| (|bfExit| (|bpPop2|) (|bpPop1|)))) T))) @@ -918,11 +908,11 @@ (DEFUN |bpDDef| () (AND (|bpName|) (|bpDefTail| #'|%Definition|))) (DEFUN |bpSimpleDefinitionTail| () - (AND (|bpEqKey| 'DEF) (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpEqKey| 'DEF) (|bpRequire| #'|bpWhere|) (|bpPush| (|%ConstantDefinition| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpCompoundDefinitionTail| (|f|) - (AND (|bpVariable|) (|bpEqKey| 'DEF) (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpVariable|) (|bpEqKey| 'DEF) (|bpRequire| #'|bpWhere|) (|bpPush| (APPLY |f| (LIST (|bpPop3|) (|bpPop2|) (|bpPop1|)))))) (DEFUN |bpDefTail| (|f|) @@ -931,7 +921,7 @@ (DEFUN |bpWhere| () (AND (|bpDefinition|) (OR - (AND (|bpEqKey| 'WHERE) (OR (|bpDefinitionItem|) (|bpTrap|)) + (AND (|bpEqKey| 'WHERE) (|bpRequire| #'|bpDefinitionItem|) (|bpPush| (|bfWhere| (|bpPop1|) (|bpPop1|)))) T))) @@ -1011,7 +1001,7 @@ (OR (|bpEqual|) (|bpConstTok|) (|bpDot|) (AND (|bpName|) (OR - (AND (|bpEqKey| 'BEC) (OR (|bpPattern|) (|bpTrap|)) + (AND (|bpEqKey| 'BEC) (|bpRequire| #'|bpPattern|) (|bpPush| (|bfAssign| (|bpPop2|) (|bpPop1|)))) T)) (|bpBracketConstruct| #'|bpPatternL|))) @@ -1023,7 +1013,7 @@ (|bpListof| #'|bpRegularPatternItemL| 'COMMA #'|bfAppend|)) (DEFUN |bpPatternColon| () - (AND (|bpEqKey| 'COLON) (OR (|bpRegularPatternItem|) (|bpTrap|)) + (AND (|bpEqKey| 'COLON) (|bpRequire| #'|bpRegularPatternItem|) (|bpPush| (LIST (|bfColon| (|bpPop1|)))))) (DEFUN |bpPatternL| () @@ -1051,19 +1041,19 @@ (DEFUN |bpPatternTail| () (AND (|bpPatternColon|) (OR - (AND (|bpEqKey| 'COMMA) (OR (|bpRegularList|) (|bpTrap|)) + (AND (|bpEqKey| 'COMMA) (|bpRequire| #'|bpRegularList|) (|bpPush| (|append| (|bpPop2|) (|bpPop1|)))) T))) (DEFUN |bpRegularBVItemTail| () (OR - (AND (|bpEqKey| 'COLON) (OR (|bpApplication|) (|bpTrap|)) + (AND (|bpEqKey| 'COLON) (|bpRequire| #'|bpApplication|) (|bpPush| (|bfTagged| (|bpPop2|) (|bpPop1|)))) - (AND (|bpEqKey| 'BEC) (OR (|bpPattern|) (|bpTrap|)) + (AND (|bpEqKey| 'BEC) (|bpRequire| #'|bpPattern|) (|bpPush| (|bfAssign| (|bpPop2|) (|bpPop1|)))) - (AND (|bpEqKey| 'IS) (OR (|bpPattern|) (|bpTrap|)) + (AND (|bpEqKey| 'IS) (|bpRequire| #'|bpPattern|) (|bpPush| (|bfAssign| (|bpPop2|) (|bpPop1|)))) - (AND (|bpEqKey| 'DEF) (OR (|bpApplication|) (|bpTrap|)) + (AND (|bpEqKey| 'DEF) (|bpRequire| #'|bpApplication|) (|bpPush| (|%DefaultValue| (|bpPop2|) (|bpPop1|)))))) (DEFUN |bpRegularBVItem| () @@ -1112,7 +1102,7 @@ (DEFUN |bpAssignLHS| () (COND ((NOT (|bpName|)) NIL) - ((|bpEqKey| 'COLON) (OR (|bpApplication|) (|bpTrap|)) + ((|bpEqKey| 'COLON) (|bpRequire| #'|bpApplication|) (|bpPush| (|bfLocal| (|bpPop2|) (|bpPop1|)))) (T (AND (|bpArgumentList|) @@ -1133,13 +1123,13 @@ (COND ((NULL |a|) (|bpTrap|)) (T (|bpPush| |a|))))))) (DEFUN |bpStruct| () - (AND (|bpEqKey| 'STRUCTURE) (OR (|bpName|) (|bpTrap|)) + (AND (|bpEqKey| 'STRUCTURE) (|bpRequire| #'|bpName|) (OR (|bpEqKey| 'DEF) (|bpTrap|)) (|bpTypeList|) (|bpPush| (|%Structure| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpTypeList| () (OR (|bpPileBracketed| #'|bpTypeItemList|) - (AND (|bpTerm| #'|bpIdList|) (|bpPush| (LIST (|bpPop1|)))))) + (AND (|bpTypeItem|) (|bpPush| (LIST (|bpPop1|)))))) (DEFUN |bpTypeItem| () (|bpTerm| #'|bpIdList|)) @@ -1147,7 +1137,7 @@ (DEFUN |bpTerm| (|idListParser|) (OR - (AND (OR (|bpName|) (|bpTrap|)) + (AND (|bpRequire| #'|bpName|) (OR (AND (|bpParenthesized| |idListParser|) (|bpPush| (|bfNameArgs| (|bpPop2|) (|bpPop1|)))) @@ -1157,7 +1147,7 @@ (DEFUN |bpIdList| () (|bpTuple| #'|bpName|)) (DEFUN |bpCase| () - (AND (|bpEqKey| 'CASE) (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpEqKey| 'CASE) (|bpRequire| #'|bpWhere|) (OR (|bpEqKey| 'OF) (|bpMissing| 'OF)) (|bpPiledCaseItems|))) (DEFUN |bpPiledCaseItems| () @@ -1172,7 +1162,7 @@ (DEFUN |bpCaseItem| () (AND (OR (|bpTerm| #'|bpCasePatternVarList|) (|bpTrap|)) - (OR (|bpEqKey| 'EXIT) (|bpTrap|)) (OR (|bpWhere|) (|bpTrap|)) + (OR (|bpEqKey| 'EXIT) (|bpTrap|)) (|bpRequire| #'|bpWhere|) (|bpPush| (|bfCaseItem| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpOutItem| () @@ -1182,7 +1172,7 @@ (PROGN (SETQ |$op| NIL) (SETQ |$GenVarCounter| 0) - (OR (|bpComma|) (|bpTrap|)) + (|bpRequire| #'|bpComma|) (SETQ |b| (|bpPop1|)) (|bpPush| (COND ((AND (CONSP |b|) (EQ (CAR |b|) '+LINE)) (LIST |b|)) |