aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/Makefile.in6
-rw-r--r--src/algebra/Makefile.pamphlet6
-rw-r--r--src/algebra/compiler.spad.pamphlet47
3 files changed, 56 insertions, 3 deletions
diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in
index 2a66efb9..75bac0b7 100644
--- a/src/algebra/Makefile.in
+++ b/src/algebra/Makefile.in
@@ -939,7 +939,8 @@ axiom_algebra_layer_user = \
ASP73 ASP27 ASP28 ASP33 ASP49 ASP7 \
ASP78 ASP9 ASP12 ASP55 ASP8 ASP19 \
ASP20 ASP30 ASP31 ASP35 ASP41 ASP42 \
- ASP74 ASP77 ASP80 ASP29 IRFORM COMPILER
+ ASP74 ASP77 ASP80 ASP29 IRFORM COMPILER \
+ ITFORM ELABOR
axiom_algebra_layer_user_nrlibs = \
$(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_user))
@@ -1015,6 +1016,9 @@ $(OUT)/ASP34.$(FASLEXT): $(OUT)/FMC.$(FASLEXT)
$(OUT)/IRFORM.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT)
$(OUT)/COMPILER.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT) $(OUT)/ENV.$(FASLEXT)
+$(OUT)/ITFORM.$(FASLEXT): $(OUT)/IRFORM.$(FASLEXT)
+$(OUT)/ELABOR.$(FASLEXT): $(OUT)/ITFORM.$(FASLEXT) $(OUT)/ENV.$(FASLEXT) \
+ $(OUT)/IRFORM.$(FASLEXT)
.PHONY: all all-algebra mkdir-output-directory
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index 60a96eca..ddbb379c 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -1018,7 +1018,8 @@ axiom_algebra_layer_user = \
ASP73 ASP27 ASP28 ASP33 ASP49 ASP7 \
ASP78 ASP9 ASP12 ASP55 ASP8 ASP19 \
ASP20 ASP30 ASP31 ASP35 ASP41 ASP42 \
- ASP74 ASP77 ASP80 ASP29 IRFORM COMPILER
+ ASP74 ASP77 ASP80 ASP29 IRFORM COMPILER \
+ ITFORM ELABOR
axiom_algebra_layer_user_nrlibs = \
$(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_user))
@@ -1094,6 +1095,9 @@ $(OUT)/ASP34.$(FASLEXT): $(OUT)/FMC.$(FASLEXT)
$(OUT)/IRFORM.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT)
$(OUT)/COMPILER.$(FASLEXT): $(OUT)/SYNTAX.$(FASLEXT) $(OUT)/ENV.$(FASLEXT)
+$(OUT)/ITFORM.$(FASLEXT): $(OUT)/IRFORM.$(FASLEXT)
+$(OUT)/ELABOR.$(FASLEXT): $(OUT)/ITFORM.$(FASLEXT) $(OUT)/ENV.$(FASLEXT) \
+ $(OUT)/IRFORM.$(FASLEXT)
@
diff --git a/src/algebra/compiler.spad.pamphlet b/src/algebra/compiler.spad.pamphlet
index 00da0a09..24d0b6d8 100644
--- a/src/algebra/compiler.spad.pamphlet
+++ b/src/algebra/compiler.spad.pamphlet
@@ -23,12 +23,53 @@
++ This domain provides representations for the intermediate
++ form data structure used by the Spad elaborator.
InternalRepresentationForm(): Public == Private where
- Public == CoercibleTo OutputForm
+ Public == Join(CoercibleTo OutputForm, HomotopicTo Syntax)
Private == add
+ coerce(x: %): Syntax == x : Syntax
+ coerce(x: Syntax): % == x : %
coerce(x: %): OutputForm ==
(x : Syntax)::OutputForm
+
+@
+
+<<domain ITFORM InternalTypeForm>>=
+)abbrev domain ITFORM InternalTypeForm
+++ Author: Gabriel Dos Reis
+++ Date Created: March 12, 2010
+++ Date Last Modified: March 12, 2010
+++ Description:
+++ This domain provides representations for internal type form.
+InternalTypeForm() == InternalRepresentationForm
+
@
+\section{Elaboration domain}
+<<domain ELABOR Elaboration>>=
+)abbrev domain ELABOR Elaboration
+Elaboration(): Public == Private where
+ Public == CoercibleTo OutputForm with
+ elaboration: (InternalRepresentationForm, InternalTypeForm, Environment) -> %
+ ++ \spad{elaboration(ir,ty,env)} construct an elaboration object for
+ ++ for the internal representation form \spad{ir}, with type \spad{ty},
+ ++ and environment \spad{env}.
+ irForm: % -> InternalRepresentationForm
+ ++ \spad{irForm(x)} returns the internal representation form of
+ ++ the elaboration \spad{x}.
+ typeForm: % -> InternalTypeForm
+ ++ \spad{typeForm(x)} returns the type form of the elaboration \spad{x}.
+ environment: % -> Environment
+ ++ \spad{environment(x)} returns the environment of the
+ ++ elaboration \spad{x}.
+ Private == add
+ Rep == Record(ir: InternalRepresentationForm,
+ type: InternalTypeForm, env: Environment)
+ irForm x == rep(x).ir
+ typeForm x == rep(x).type
+ environment x == rep(x).env
+ coerce(x: %): OutputForm ==
+ bracket([irForm(x)::OutputForm, typeForm(x)::OutputForm,
+ environment(x)::OutputForm])$OutputForm
+@
\section{A Package for the Spad Compiler}
@@ -45,10 +86,14 @@ CompilerPackage(): Public == Private where
++ \spad{macroExpand(s,e)} traverses the syntax object \spad{s}
++ replacing all (niladic) macro invokations with the
++ corresponding substitution.
+ elaborate: Syntax -> Elaboration
+ ++ \spad{elaborate(s)} returns the elaboration of the syntax
+ ++ object \spad{s} in the empty environement.
Private == add
macroExpand(s,e) ==
-- FIXME: this is a short-term stopgap.
macroExpand(s,e)$Foreign(Builtin)
+
@