diff options
author | dos-reis <gdr@axiomatics.org> | 2008-05-08 07:58:35 +0000 |
---|---|---|
committer | dos-reis <gdr@axiomatics.org> | 2008-05-08 07:58:35 +0000 |
commit | 78b4bdac02e3f64db5acfa9ebdb1b88696b9a405 (patch) | |
tree | 9c8ce4a028ffddddf3d5e05690fc504a8eef6026 /src/boot/translator.boot | |
parent | 777de75052c863d618cb03e083bad5f050f5e6f3 (diff) | |
download | open-axiom-78b4bdac02e3f64db5acfa9ebdb1b88696b9a405.tar.gz |
* boot/translator.boot (translateToplevel): Split out of bpOutItem.
(maybeExportDecl): New.
Diffstat (limited to 'src/boot/translator.boot')
-rw-r--r-- | src/boot/translator.boot | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/boot/translator.boot b/src/boot/translator.boot index 02d809ba..ec6d6eab 100644 --- a/src/boot/translator.boot +++ b/src/boot/translator.boot @@ -466,41 +466,60 @@ translateToplevelExpression expr == #expr' > 1 => ["PROGN",:expr'] first expr' -bpOutItem()== - $op := nil - bpComma() or bpTrap() - b:=bpPop1() - EQCAR(b,"TUPLE")=> bpPush rest b - EQCAR(b,"+LINE")=> bpPush [ b ] - b is ["L%T",l,r] and IDENTP l => - bpPush [["DEFPARAMETER",l,r]] +maybeExportDecl(d,export?) == + export? => d + d + +translateToplevel(b,export?) == + b is ["TUPLE",:xs] => [maybeExportDecl(x,export?) for x in xs] case b of Signature(op,t) => - bpPush [genDeclaration(op,t)] + [maybeExportDecl(genDeclaration(op,t),export?)] %Module(m,ds) => $currentModuleName := m $foreignsDefsForCLisp := nil - bpPush [["PROVIDE", STRING m], - :[translateSignatureDeclaration d for d in ds]] + [["PROVIDE", STRING m], + :[translateToplevel(d,true) for d in ds]] Import(m) => - bpPush [["IMPORT-MODULE", STRING m]] + [["IMPORT-MODULE", STRING m]] ImportSignature(x, sig) => - bpPush genImportDeclaration(x, sig) + genImportDeclaration(x, sig) + + %TypeAlias(lhs, rhs) => + [maybeExportDecl(genTypeAlias(lhs,rhs),export?)] - TypeAlias(lhs, rhs) => - bpPush [genTypeAlias(lhs,rhs)] + ConstantDefinition(lhs,rhs) => + sig := nil + if lhs is ["%Signature",n,t] then + sig := maybeExportDecl(genDeclaration(n,t),export?) + lhs := n + [maybeExportDecl(["DEFCONSTANT",lhs,rhs],export?)] - ConstantDefinition(n, e) => - bpPush [["DEFCONSTANT", n, e]] + %Assignment(lhs,rhs) => + sig := nil + if lhs is ["%Signature",n,t] then + sig := maybeExportDecl(genDeclaration(n,t),export?) + lhs := n + [maybeExportDecl(["DEFPARAMETER",lhs,rhs],export?)] namespace(n) => - bpPush [["IN-PACKAGE",STRING n]] + [["IN-PACKAGE",STRING n]] otherwise => - bpPush [translateToplevelExpression b] + [translateToplevelExpression b] + + +bpOutItem()== + $op := nil + bpComma() or bpTrap() + b:=bpPop1() + EQCAR(b,"+LINE")=> bpPush [ b ] + b is ["L%T",l,r] and IDENTP l => + bpPush [["DEFPARAMETER",l,r]] + bpPush translateToplevel(b,false) shoeAddbootIfNec s == shoeAddStringIfNec('".boot",s) |