diff options
author | dos-reis <gdr@axiomatics.org> | 2010-05-10 02:32:04 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2010-05-10 02:32:04 +0000 |
commit | cc1b3ad0c3e2375bff3d0d736b988d41840dcadd (patch) | |
tree | 4d92d50afb94d5e62303733bc35b5635163f5f39 /src/boot/parser.boot | |
parent | fff23d752812e2ae22bebc21d24c42bb145a916e (diff) | |
download | open-axiom-cc1b3ad0c3e2375bff3d0d736b988d41840dcadd.tar.gz |
Add lambda expression syntax to Boot.
* boot/parser.boot (bpLambda): New.
* boot/ast.boot (bfLambda): New.
* boot/tokens.boot: Add "+->" as token.
* interp/cparse.boot: Use lambda expression syntax.
* interp/c-util.boot: Likewise.
Diffstat (limited to 'src/boot/parser.boot')
-rw-r--r-- | src/boot/parser.boot | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/boot/parser.boot b/src/boot/parser.boot index ce22eb37..e754375d 100644 --- a/src/boot/parser.boot +++ b/src/boot/parser.boot @@ -800,6 +800,9 @@ bpAssign()== bpEqPeek "BEC" => bpRestore a bpAssignment() or bpTrap() + bpEqPeek "GIVES" => + bpRestore a + bpLambda() or bpTrap() true bpRestore a false @@ -810,6 +813,14 @@ bpAssignment()== (bpAssign() or bpTrap()) and bpPush bfAssign (bpPop2(),bpPop1()) +++ Parse a lambda expression +++ Lambda ::= Variable +-> Assign +bpLambda() == + bpVariable() and + bpEqKey "GIVES" and + (bpAssign() or bpTrap()) and + bpPush bfLambda(bpPop2(),bpPop1()) + -- should only be allowed in sequences bpExit()== bpAssign() and (bpEqKey "EXIT" and |