aboutsummaryrefslogtreecommitdiff
path: root/src/algebra
diff options
context:
space:
mode:
authordos-reis <gdr@axiomatics.org>2008-01-14 12:17:21 +0000
committerdos-reis <gdr@axiomatics.org>2008-01-14 12:17:21 +0000
commit4a4b92d282fbe89881b469ed0a8ac25bf33cad05 (patch)
treed730a25c62f6cddf337d4dedf55de6002ebb73da /src/algebra
parentef3e16960ee4d9d1c02c1f63a7f8125a489d1373 (diff)
downloadopen-axiom-4a4b92d282fbe89881b469ed0a8ac25bf33cad05.tar.gz
* interp/compiler.boot (compSymbol): Don't handle possible
case views here. (hasUniqueCaseView): Rename from getUniqueCaseView. Take the target mode as second argument. (compForm2): Use calling convention vector to determine infer flag parameter types. (compCase1): Uniformly handle `case-expressions'. Call genDeltaEntry for selected operator. (coerceExtraHard): Handle coercions from UnionType domains. (autoCoerceByModemap): Tidy. * interp/g-opt.boot (optCall): Be more verbose in diagnostics. * algebra/syntax.spad (Syntax): Rework. * algebra/coerce.spad.pamphlet (UnionType): New. * algebra/Makefile.pamphlet (axiom_algebra_layer_0): Include UTYPE.o * share/algebra: Update databases.
Diffstat (limited to 'src/algebra')
-rw-r--r--src/algebra/Makefile.in2
-rw-r--r--src/algebra/Makefile.pamphlet2
-rw-r--r--src/algebra/coerce.spad.pamphlet21
-rw-r--r--src/algebra/syntax.spad24
4 files changed, 34 insertions, 15 deletions
diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in
index 3d9371db..a974ad21 100644
--- a/src/algebra/Makefile.in
+++ b/src/algebra/Makefile.in
@@ -377,7 +377,7 @@ axiom_algebra_layer_0 = \
KOERCE.o KONVERT.o MSYSCMD.o ODEIFTBL.o \
OM.o OMCONN.o OMDEV.o OUT.o \
PRIMCAT.o PRINT.o PTRANFN.o SPFCAT.o \
- TYPE.o
+ TYPE.o UTYPE.o
axiom_algebra_layer_0_nrlibs = \
$(axiom_algebra_layer_0:.$(OBJEXT)=.NRLIB/code.$(OBJEXT))
diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet
index c24752fb..45f1f2bd 100644
--- a/src/algebra/Makefile.pamphlet
+++ b/src/algebra/Makefile.pamphlet
@@ -205,7 +205,7 @@ axiom_algebra_layer_0 = \
KOERCE.o KONVERT.o MSYSCMD.o ODEIFTBL.o \
OM.o OMCONN.o OMDEV.o OUT.o \
PRIMCAT.o PRINT.o PTRANFN.o SPFCAT.o \
- TYPE.o
+ TYPE.o UTYPE.o
axiom_algebra_layer_0_nrlibs = \
$(axiom_algebra_layer_0:.$(OBJEXT)=.NRLIB/code.$(OBJEXT))
diff --git a/src/algebra/coerce.spad.pamphlet b/src/algebra/coerce.spad.pamphlet
index 3ad352b6..f270bba6 100644
--- a/src/algebra/coerce.spad.pamphlet
+++ b/src/algebra/coerce.spad.pamphlet
@@ -2,7 +2,7 @@
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/algebra coerce.spad}
-\author{Richard Jenks, Manuel Bronstein}
+\author{Richard Jenks, Manuel Bronstein, Gabriel Dos Reis}
\maketitle
\begin{abstract}
\end{abstract}
@@ -20,6 +20,24 @@
Type(): Category == with nil
@
+
+
+\section{Category UnionType}
+
+<<category UTYPE UnionType>>=
+)abbrev category UTYPE UnionType
+++ Author: Gabriel Dos Reis
+++ Date Created: December 17, 2007
+++ Date Last Modified: December 17, 2007
+++ Description: The category of domains that act like unions.
+++ UnionType, like Type or Category, acts mostly as a take that
+++ communicates `union-like' intended semantics to the compiler.
+++ A domain D that satifies UnionType should provide definitions
+++ for `case' operators, with corresponding `autoCoerce' operators.
+UnionType(): Category == with nil
+@
+
+
\section{category KOERCE CoercibleTo}
<<category KOERCE CoercibleTo>>=
)abbrev category KOERCE CoercibleTo
@@ -114,6 +132,7 @@ RetractableTo(S: Type): Category == with
<<license>>
<<category TYPE Type>>
+<<category UTYPE UnionType>>
<<category KOERCE CoercibleTo>>
<<category KONVERT ConvertibleTo>>
<<category RETRACT RetractableTo>>
diff --git a/src/algebra/syntax.spad b/src/algebra/syntax.spad
index 2dd65ccb..b6331f4f 100644
--- a/src/algebra/syntax.spad
+++ b/src/algebra/syntax.spad
@@ -43,7 +43,7 @@
++ Fixme: Provide direct support for boolean values, arbritrary
++ precision float point values.
Syntax(): Public == Private where
- Public ==> CoercibleTo(OutputForm) with
+ Public ==> Join(UnionType, CoercibleTo(OutputForm)) with
convert: % -> SExpression
++ convert(s) returns the s-expression representation of a syntax.
@@ -55,26 +55,26 @@ Syntax(): Public == Private where
coerce: Integer -> %
++ coerce(i) injects the integer value `i' into the Syntax domain
- convert: % -> Integer
+ coerce: % -> Integer
++ coerce(i) extracts the integer value `i' from the Syntax domain
coerce: DoubleFloat -> %
++ coerce(f) injects the float value `f' into the Syntax domain
- convert: % -> DoubleFloat
- ++ convert(f) extracts the float value `f' from the Syntax domain
+ coerce: % -> DoubleFloat
+ ++ coerce(f) extracts the float value `f' from the Syntax domain
coerce: Symbol -> %
++ coerce(s) injects the symbol `s' into the Syntax domain.
- convert: % -> Symbol
- ++ convert(s) extracts the symbol `s' from the Syntax domain.
+ coerce: % -> Symbol
+ ++ coerce(s) extracts the symbol `s' from the Syntax domain.
coerce: String -> %
++ coerce(s) injects the string value `s' into the syntax domain
- convert: % -> String
- ++ convert(s) extract the string value `s' from the syntax domain
+ coerce: % -> String
+ ++ coerce(s) extract the string value `s' from the syntax domain
buildSyntax: (Symbol, List %) -> %
++ buildSyntax(op, [a1, ..., an]) builds a syntax object for op(a1,...,an).
@@ -135,28 +135,28 @@ Syntax(): Public == Private where
coerce(i: Integer): % ==
i pretend %
- convert(i: %): Integer ==
+ ccoerce(i: %): Integer ==
i case Integer => i
userError "invalid conversion target type"
coerce(f: DoubleFloat): % ==
f pretend %
- convert(f: %): DoubleFloat ==
+ coerce(f: %): DoubleFloat ==
f case DoubleFloat => f
userError "invalid conversion target type"
coerce(s: Symbol): % ==
s pretend %
- convert(s: %): Symbol ==
+ coerce(s: %): Symbol ==
s case Symbol => s
userError "invalid conversion target type"
coerce(s: String): % ==
s pretend %
- convert(s: %): String ==
+ coerce(s: %): String ==
s case String => s
userError "invalid conversion target type"