aboutsummaryrefslogtreecommitdiff
path: root/src/boot
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-07-23 05:16:50 +0000
committerdos-reis <gdr@axiomatics.org>2008-07-23 05:16:50 +0000
commitc5b5b8c2d510d3719704347840982b685fe8220d (patch)
treef31fb6e1451b4910b4a65296c239cbb9772a4ee1 /src/boot
parentccbb46defe28a8aa9e554d25d1542c8353a4cf4f (diff)
downloadopen-axiom-c5b5b8c2d510d3719704347840982b685fe8220d.tar.gz
Misc cleanup.
Diffstat (limited to 'src/boot')
-rw-r--r--src/boot/parser.boot44
-rw-r--r--src/boot/translator.boot4
2 files changed, 42 insertions, 6 deletions
diff --git a/src/boot/parser.boot b/src/boot/parser.boot
index 1cf9330f..abb743f7 100644
--- a/src/boot/parser.boot
+++ b/src/boot/parser.boot
@@ -411,11 +411,35 @@ bpConstTok() ==
bpString()
+++ Subroutine of bpExportItem. Parses tails of ExportItem.
+bpExportItemTail() ==
+ bpEqKey "BEC" and (bpAssign() or bpTrap()) and
+ bpPush %Assignment(bpPop2(), bpPop1())
+ or bpSimpleDefinitionTail()
+
+++ ExportItem:
+++ Structure
+++ TypeAliasDefinition
+++ Signature
+++ Signature := Where
+++ Signature == Where
+bpExportItem() ==
+ bpEqPeek "STRUCTURE" => bpStruct()
+ a := bpState()
+ bpName() =>
+ bpEqPeek "COLON" =>
+ bpRestore a
+ bpSignature() or bpTrap()
+ bpExportItemTail() or true
+ bpRestore a
+ bpTypeAliasDefition()
+ false
+
++ ExportItemList:
++ Signature
++ ExportItemList Signature
bpExportItemList() ==
- bpListAndRecover function bpSignature
+ bpListAndRecover function bpExportItem
++ Exports:
++ pile-bracketed ExporItemList
@@ -460,13 +484,25 @@ bpSignature() ==
bpName() and bpEqKey "COLON" and bpMapping()
and bpPush Signature(bpPop2(), bpPop1())
+++ SimpleMapping:
+++ Application
+++ Application -> Application
+bpSimpleMapping() ==
+ bpApplication() =>
+ bpEqKey "ARROW" and (bpApplication() or bpTrap()) and
+ bpPush Mapping(bpPop1(), bfUntuple bpPop1())
+ true
+ false
+
++ Parse a mapping expression
++ Mapping:
-++ (Name | IdList) -> Name
+++ (IdList) -> Application
+++ SimpleMapping
bpMapping() ==
- (bpName() or bpParenthesized function bpIdList) and
- bpEqKey "ARROW" and bpName() and
+ bpParenthesized function bpIdList and
+ bpEqKey "ARROW" and bpApplication() and
bpPush Mapping(bpPop1(), bfUntuple bpPop1())
+ or bpSimpleMapping()
bpCancel()==
a:=bpState()
diff --git a/src/boot/translator.boot b/src/boot/translator.boot
index 2aee7c21..01778e2e 100644
--- a/src/boot/translator.boot
+++ b/src/boot/translator.boot
@@ -38,8 +38,8 @@ import scanner
import pile
import parser
import ast
-module translator
namespace BOOTTRAN
+module translator
++ If non nil, holds the name of the current module being translated.
$currentModuleName := nil
@@ -502,7 +502,7 @@ translateToplevel(b,export?) ==
$currentModuleName := m
$foreignsDefsForCLisp := nil
[["PROVIDE", STRING m],
- :[translateToplevel(d,true) for d in ds]]
+ :[first translateToplevel(d,true) for d in ds]]
Import(m) =>
[["IMPORT-MODULE", STRING m]]