diff options
author | dos-reis <gdr@axiomatics.org> | 2009-08-30 00:02:33 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2009-08-30 00:02:33 +0000 |
commit | 9fecfc240728b7953537c2a2c837f7a420c274af (patch) | |
tree | 3f25889973d1c7d915b75ea752b429fca4b4fa39 /src | |
parent | 3fc1f3a489b51d2e33830516b389ac63edb664a7 (diff) | |
download | open-axiom-9fecfc240728b7953537c2a2c837f7a420c274af.tar.gz |
* boot/parser.boot ($sawParenthesizedHead): Remove.
(bpReturnType): Likewise.
(bpBeginParameterList): Likewise.
(bpEndParameterList): Likewise.
(bpBeginDefinition): Likewise.
(bpDefinition): Adjust.
(bpVariable): Likewise.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 10 | ||||
-rw-r--r-- | src/boot/parser.boot | 40 | ||||
-rw-r--r-- | src/boot/strap/parser.clisp | 40 |
3 files changed, 20 insertions, 70 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0f536330..272b67e9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,15 @@ 2009-08-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + * boot/parser.boot ($sawParenthesizedHead): Remove. + (bpReturnType): Likewise. + (bpBeginParameterList): Likewise. + (bpEndParameterList): Likewise. + (bpBeginDefinition): Likewise. + (bpDefinition): Adjust. + (bpVariable): Likewise. + +2009-08-29 Gabriel Dos Reis <gdr@cs.tamu.edu> + * boot/ast.boot (bfCase): Don't hold scrutinee's remaining structure in a temporary. (bfCI): Adjust generation of selectors. diff --git a/src/boot/parser.boot b/src/boot/parser.boot index 52169219..eb070e8a 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -46,10 +46,6 @@ namespace BOOTTRAN module parser -++ true when the current function definition has its parameters -++ written round parenthesis. -$sawParenthesizedHead := false - bpFirstToken()== $stok:= if null $inputStream @@ -842,15 +838,10 @@ bpExit()== bpPush bfExit (bpPop2(),bpPop1())) or true) -++ returns true if the next token introduces a definition. -bpBeginDefinition() == - bpEqPeek "DEF" or - $sawParenthesizedHead and bpEqPeek "COLON" - bpDefinition()== a:=bpState() bpExit() => - bpBeginDefinition() => + bpEqPeek "DEF" => bpRestore a bpDef() bpEqPeek "TDEF" => @@ -867,19 +858,8 @@ bpStoreName()== $op := first $stack $wheredefs := nil $typings := nil - $returnType := true -- assume we may return anything true -bpReturnType() == - -- a return type is acceptable for a function definition only - -- if its parameters are written in round parenthesis. - -- In particular, we reject the situation `foo x:Integer == ...' - $sawParenthesizedHead and bpEqKey "COLON" => - bpApplication() or bpTrap() - $returnType := bpPop1() - true - true - bpDef() == bpName() and bpStoreName() and bpDefTail() @@ -893,9 +873,9 @@ bpSimpleDefinitionTail() == ++ Parse the remaining of a compound definition. bpCompoundDefinitionTail() == - bpVariable() and bpReturnType() and - bpEqKey "DEF" and (bpWhere() or bpTrap()) - and bpPush %Definition(bpPop3(),bpPop2(),bpPop1()) + bpVariable() and + bpEqKey "DEF" and (bpWhere() or bpTrap()) and + bpPush %Definition(bpPop3(),bpPop2(),bpPop1()) ++ Parse the remainding of a definition. When we reach this point @@ -1090,19 +1070,9 @@ bpBoundVariablelist()== else bpColonName() and bpPush bfColonAppend(nil,bpPop1()) -++ Mark the start of parameter list enclosed in round parenthesis -bpBeginParameterList() == - $sawParenthesizedHead := false - true - -++ Mark the end of parameter list enclosed in round parenthesis -bpEndParameterList() == - $sawParenthesizedHead := true - bpVariable()== - bpBeginParameterList() and bpParenthesized function bpBoundVariablelist and - bpPush bfTupleIf bpPop1() and bpEndParameterList() + bpPush bfTupleIf bpPop1() or bpBracketConstruct function bpPatternL or bpName() or bpConstTok() diff --git a/src/boot/strap/parser.clisp b/src/boot/strap/parser.clisp index fd1472d2..36bece77 100644 --- a/src/boot/strap/parser.clisp +++ b/src/boot/strap/parser.clisp @@ -9,8 +9,6 @@ (PROVIDE "parser") -(DEFPARAMETER |$sawParenthesizedHead| NIL) - (DEFUN |bpFirstToken| () (DECLARE (SPECIAL |$ttok| |$stok| |$inputStream|)) (PROGN @@ -872,11 +870,6 @@ (|bpPush| (|bfExit| (|bpPop2|) (|bpPop1|)))) T))) -(DEFUN |bpBeginDefinition| () - (DECLARE (SPECIAL |$sawParenthesizedHead|)) - (OR (|bpEqPeek| 'DEF) - (AND |$sawParenthesizedHead| (|bpEqPeek| 'COLON)))) - (DEFUN |bpDefinition| () (PROG (|a|) (RETURN @@ -885,8 +878,7 @@ (COND ((|bpExit|) (COND - ((|bpBeginDefinition|) - (PROGN (|bpRestore| |a|) (|bpDef|))) + ((|bpEqPeek| 'DEF) (PROGN (|bpRestore| |a|) (|bpDef|))) ((|bpEqPeek| 'TDEF) (PROGN (|bpRestore| |a|) (|bpTypeAliasDefition|))) ((|bpEqPeek| 'MDEF) (PROGN (|bpRestore| |a|) (|bpMdef|))) @@ -894,25 +886,13 @@ (#0# (PROGN (|bpRestore| |a|) NIL))))))) (DEFUN |bpStoreName| () - (DECLARE (SPECIAL |$returnType| |$typings| |$wheredefs| |$op| - |$stack|)) + (DECLARE (SPECIAL |$typings| |$wheredefs| |$op| |$stack|)) (PROGN (SETQ |$op| (CAR |$stack|)) (SETQ |$wheredefs| NIL) (SETQ |$typings| NIL) - (SETQ |$returnType| T) T)) -(DEFUN |bpReturnType| () - (DECLARE (SPECIAL |$returnType| |$sawParenthesizedHead|)) - (COND - ((AND |$sawParenthesizedHead| (|bpEqKey| 'COLON)) - (PROGN - (OR (|bpApplication|) (|bpTrap|)) - (SETQ |$returnType| (|bpPop1|)) - T)) - ('T T))) - (DEFUN |bpDef| () (AND (|bpName|) (|bpStoreName|) (|bpDefTail|))) (DEFUN |bpDDef| () (AND (|bpName|) (|bpDefTail|))) @@ -922,8 +902,7 @@ (|bpPush| (|%ConstantDefinition| (|bpPop2|) (|bpPop1|))))) (DEFUN |bpCompoundDefinitionTail| () - (AND (|bpVariable|) (|bpReturnType|) (|bpEqKey| 'DEF) - (OR (|bpWhere|) (|bpTrap|)) + (AND (|bpVariable|) (|bpEqKey| 'DEF) (OR (|bpWhere|) (|bpTrap|)) (|bpPush| (|%Definition| (|bpPop3|) (|bpPop2|) (|bpPop1|))))) (DEFUN |bpDefTail| () @@ -1114,18 +1093,9 @@ ('T (AND (|bpColonName|) (|bpPush| (|bfColonAppend| NIL (|bpPop1|))))))) -(DEFUN |bpBeginParameterList| () - (DECLARE (SPECIAL |$sawParenthesizedHead|)) - (PROGN (SETQ |$sawParenthesizedHead| NIL) T)) - -(DEFUN |bpEndParameterList| () - (DECLARE (SPECIAL |$sawParenthesizedHead|)) - (SETQ |$sawParenthesizedHead| T)) - (DEFUN |bpVariable| () - (OR (AND (|bpBeginParameterList|) - (|bpParenthesized| #'|bpBoundVariablelist|) - (|bpPush| (|bfTupleIf| (|bpPop1|))) (|bpEndParameterList|)) + (OR (AND (|bpParenthesized| #'|bpBoundVariablelist|) + (|bpPush| (|bfTupleIf| (|bpPop1|)))) (|bpBracketConstruct| #'|bpPatternL|) (|bpName|) (|bpConstTok|))) (DEFUN |bpAssignVariable| () |