diff options
Diffstat (limited to 'src/algebra')
-rw-r--r-- | src/algebra/Makefile.in | 21 | ||||
-rw-r--r-- | src/algebra/Makefile.pamphlet | 21 | ||||
-rw-r--r-- | src/algebra/catdef.spad.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/domain.spad.pamphlet | 256 | ||||
-rw-r--r-- | src/algebra/exposed.lsp.pamphlet | 2 | ||||
-rw-r--r-- | src/algebra/outform.spad.pamphlet | 95 | ||||
-rw-r--r-- | src/algebra/syntax.spad.pamphlet | 93 | ||||
-rw-r--r-- | src/algebra/term.spad.pamphlet | 8 |
8 files changed, 314 insertions, 184 deletions
diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 1fe56152..0e301731 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -359,7 +359,7 @@ axiom_algebra_layer_0 = \ KRCFROM KVTFROM \ MSYSCMD OM OMCONN OMDEV OUT \ PRIMCAT PRINT PTRANFN SPFCAT TYPE UTYPE \ - PROPERTY BASTYPE BASTYPE- CATEGORY LMODULE \ + PROPERTY BASTYPE BASTYPE- LMODULE \ RMODULE FINITE STEP SGROUP SGROUP- ABELSG \ ABELSG- ORDSET ORDSET- FILECAT SEXCAT \ MKBCFUNC MKRECORD MKUCFUNC DROPT1 PLOT1 ITFUN2 \ @@ -389,7 +389,7 @@ axiom_algebra_layer_2 = \ ELTAGG ELTAGG- FMC FMFUN FORTFN FVC \ SYNTAX FVFUN INTRET IXAGG IXAGG- SEGXCAT \ CONTOUR LIST3 MKFUNC OASGP KTVLOGIC FNCAT \ - BYTE + BYTE IDENT axiom_algebra_layer_2_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_2)) @@ -399,7 +399,7 @@ axiom_algebra_layer_2_objects = \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_2))) axiom_algebra_layer_3 = \ GRDEF SCOPE MAPHACK1 MAPHACK2 MAPHACK3 MAPPKG1 \ - MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- CTORCALL + MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- @@ -663,7 +663,7 @@ axiom_algebra_layer_15_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_15))) axiom_algebra_layer_16 = \ - DPMM EFUPXS FFINTBAS FRIDEAL OPERCAT \ + DPMM EFUPXS FFINTBAS FRIDEAL OPERCAT OPERCAT- \ FRIDEAL2 FRMOD \ IBATOOL INTFACT \ MSETAGG MONOGEN MONOGEN- NFINTBAS \ @@ -676,8 +676,8 @@ axiom_algebra_layer_16_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_16))) axiom_algebra_layer_17 = \ - CCLASS FSAGG2 GALFACT IALGFACT \ - IBACHIN MMLFORM NORMMA ODERED OMSAGG \ + CCLASS FSAGG2 GALFACT IALGFACT CTORCAT CTORCAT- \ + IBACHIN MMLFORM NORMMA ODERED OMSAGG OPSIG \ PERM PERMGRP PRIMES PWFFINTB \ RDIST SAE SAEFACT SAERFFC \ SGCF VIEW3D @@ -689,7 +689,7 @@ axiom_algebra_layer_17_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_17))) axiom_algebra_layer_18 = \ -INTPACK IPF \ + INTPACK IPF CATCTOR DOMCTOR CTORCALL \ KAFILE PATRES TBCMPPK axiom_algebra_layer_18_nrlibs = \ @@ -812,7 +812,7 @@ axiom_algebra_layer_22_objects = \ axiom_algebra_layer_23 = \ CPIMA IRURPK LAZM3PK LEXTRIPK \ NORMPK QCMPACK RURPK SFRGCD \ - SFQCMPK INTRVL ODEEF DOMAIN + SFQCMPK INTRVL ODEEF DOMAIN CATEGORY axiom_algebra_layer_23_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_23)) @@ -822,13 +822,13 @@ axiom_algebra_layer_23_objects = \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_23))) axiom_algebra_layer_user = \ RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ - LITERAL IDENT TYPEAST IMPTAST MAPPAST ATTRAST \ + LITERAL TYPEAST IMPTAST MAPPAST ATTRAST \ JOINAST IFAST RPTAST WHILEAST INAST CLLCAST \ LSTAST EXITAST RETAST SEGAST PRTDAST CRCAST \ LETAST SUCHAST RDUCEAST COLONAST ADDAST CAPSLAST \ CASEAST HASAST ISAST CATAST WHEREAST COMMAAST \ QQUTAST DEFAST MACROAST SPADXPT SPADAST \ - INBFILE OUTBFILE IOBFILE RGBCMDL RGBCSPC CTORKIND \ + INBFILE OUTBFILE IOBFILE RGBCMDL RGBCSPC \ CTOR IP4ADDR NETCLT INETCLTS axiom_algebra_layer_user_nrlibs = \ @@ -840,7 +840,6 @@ axiom_algebra_layer_user_objects = \ SASTCAT.NRLIB/code.$(FASLEXT): $(OUT)/ASTCAT.$(FASLEXT) LITERAL.NRLIB/code.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) -IDENT.NRLIB/code.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) HEADAST.NRLIB/code.$(FASLEXT): $(OUT)/IDENT.$(FASLEXT) SPADXPT.NRLIB/code.$(FASLEXT): $(OUT)/ASTCAT.$(FASLEXT) ATTRAST.NRLIB/code.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index 2dccf863..8e96e46b 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -188,7 +188,7 @@ axiom_algebra_layer_0 = \ KRCFROM KVTFROM \ MSYSCMD OM OMCONN OMDEV OUT \ PRIMCAT PRINT PTRANFN SPFCAT TYPE UTYPE \ - PROPERTY BASTYPE BASTYPE- CATEGORY LMODULE \ + PROPERTY BASTYPE BASTYPE- LMODULE \ RMODULE FINITE STEP SGROUP SGROUP- ABELSG \ ABELSG- ORDSET ORDSET- FILECAT SEXCAT \ MKBCFUNC MKRECORD MKUCFUNC DROPT1 PLOT1 ITFUN2 \ @@ -239,7 +239,7 @@ axiom_algebra_layer_2 = \ ELTAGG ELTAGG- FMC FMFUN FORTFN FVC \ SYNTAX FVFUN INTRET IXAGG IXAGG- SEGXCAT \ CONTOUR LIST3 MKFUNC OASGP KTVLOGIC FNCAT \ - BYTE + BYTE IDENT axiom_algebra_layer_2_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_2)) @@ -260,7 +260,7 @@ grdef.spad.pamphlet (GRDEF) <<layer3>>= axiom_algebra_layer_3 = \ GRDEF SCOPE MAPHACK1 MAPHACK2 MAPHACK3 MAPPKG1 \ - MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- CTORCALL + MAPPKG2 MAPPKG3 INTBIT MONAD MONAD- @@ -812,7 +812,7 @@ space.spad.pamphlet (SPACEC SPACE3 TOPSP) <<layer16>>= axiom_algebra_layer_16 = \ - DPMM EFUPXS FFINTBAS FRIDEAL OPERCAT \ + DPMM EFUPXS FFINTBAS FRIDEAL OPERCAT OPERCAT- \ FRIDEAL2 FRMOD \ IBATOOL INTFACT \ MSETAGG MONOGEN MONOGEN- NFINTBAS \ @@ -851,8 +851,8 @@ view3D.spad.pamphlet (VIEW3D) <<layer17>>= axiom_algebra_layer_17 = \ - CCLASS FSAGG2 GALFACT IALGFACT \ - IBACHIN MMLFORM NORMMA ODERED OMSAGG \ + CCLASS FSAGG2 GALFACT IALGFACT CTORCAT CTORCAT- \ + IBACHIN MMLFORM NORMMA ODERED OMSAGG OPSIG \ PERM PERMGRP PRIMES PWFFINTB \ RDIST SAE SAEFACT SAERFFC \ SGCF VIEW3D @@ -878,7 +878,7 @@ table.spad.pamphlet (HASHTBL INTABL TABLE EQTBL STRTBL GSTBL STBL) <<layer18>>= axiom_algebra_layer_18 = \ -INTPACK IPF \ + INTPACK IPF CATCTOR DOMCTOR CTORCALL \ KAFILE PATRES TBCMPPK axiom_algebra_layer_18_nrlibs = \ @@ -1232,7 +1232,7 @@ zerodim.spad.pamphlet (LEXTRIPK IRURPK RURPK) axiom_algebra_layer_23 = \ CPIMA IRURPK LAZM3PK LEXTRIPK \ NORMPK QCMPACK RURPK SFRGCD \ - SFQCMPK INTRVL ODEEF DOMAIN + SFQCMPK INTRVL ODEEF DOMAIN CATEGORY axiom_algebra_layer_23_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_23)) @@ -1249,13 +1249,13 @@ we add it here. <<USERLAYER>>= axiom_algebra_layer_user = \ RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ - LITERAL IDENT TYPEAST IMPTAST MAPPAST ATTRAST \ + LITERAL TYPEAST IMPTAST MAPPAST ATTRAST \ JOINAST IFAST RPTAST WHILEAST INAST CLLCAST \ LSTAST EXITAST RETAST SEGAST PRTDAST CRCAST \ LETAST SUCHAST RDUCEAST COLONAST ADDAST CAPSLAST \ CASEAST HASAST ISAST CATAST WHEREAST COMMAAST \ QQUTAST DEFAST MACROAST SPADXPT SPADAST \ - INBFILE OUTBFILE IOBFILE RGBCMDL RGBCSPC CTORKIND \ + INBFILE OUTBFILE IOBFILE RGBCMDL RGBCSPC \ CTOR IP4ADDR NETCLT INETCLTS axiom_algebra_layer_user_nrlibs = \ @@ -1267,7 +1267,6 @@ axiom_algebra_layer_user_objects = \ SASTCAT.NRLIB/code.$(FASLEXT): $(OUT)/ASTCAT.$(FASLEXT) LITERAL.NRLIB/code.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) -IDENT.NRLIB/code.$(FASLEXT): $(OUT)/SASTCAT.$(FASLEXT) HEADAST.NRLIB/code.$(FASLEXT): $(OUT)/IDENT.$(FASLEXT) SPADXPT.NRLIB/code.$(FASLEXT): $(OUT)/ASTCAT.$(FASLEXT) ATTRAST.NRLIB/code.$(FASLEXT): $(OUT)/SPADXPT.$(FASLEXT) diff --git a/src/algebra/catdef.spad.pamphlet b/src/algebra/catdef.spad.pamphlet index 45d087d0..42aeedb3 100644 --- a/src/algebra/catdef.spad.pamphlet +++ b/src/algebra/catdef.spad.pamphlet @@ -1630,7 +1630,7 @@ SetCategory(): Category == Join(BasicType,CoercibleTo OutputForm) with latex: % -> String ++ latex(s) returns a LaTeX-printable output ++ representation of s. add - hash(s : %): SingleInteger == 0$SingleInteger + hash(s : %): SingleInteger == SXHASH(s)$Lisp latex(s : %): String == "\mbox{\bf Unimplemented}" @ diff --git a/src/algebra/domain.spad.pamphlet b/src/algebra/domain.spad.pamphlet index 6619feb0..64415657 100644 --- a/src/algebra/domain.spad.pamphlet +++ b/src/algebra/domain.spad.pamphlet @@ -25,78 +25,267 @@ ++ constructors, and package constructors. ConstructorKind(): Public == Private where Public == SetCategory with - category: % ++ `category' designates category constructors - domain: % ++ `domain' designates domain constructors - package: % ++ `package' designates package constructors. + category: % ++ `category' is the kind of category constructors + domain: % ++ `domain' is the kind of domain constructors + package: % ++ `package' is the kind of package constructors. Private == add - category == INTERN("category","KEYWORD")$Lisp - domain == INTERN("domain","KEYWORD")$Lisp - package == INTERN("package","KEYWORD")$Lisp + category == 'category : % + domain == 'domain : % + package == 'package : % k1 = k2 == EQ(k1,k2)$Lisp - coerce(k: %): OutputForm == - k = category => outputForm 'category - k = domain => outputForm 'domain - outputForm 'package + coerce(k: %): OutputForm == k : OutputForm @ +<<category CTORCAT ConstructorCategory>>= +import ConstructorKind +)abbrev category CTORCAT ConstructorCategory +++ Author: Gabriel Dos Reis +++ Date Create: December 17, 2008. +++ Date Last Updated: December 21, 2008. +++ Basic Operations: name, kind, arity. +++ Description: +++ This category declares basic operations on all constructors. +ConstructorCategory(): Category == OperatorCategory Identifier with + kind: % -> ConstructorKind + ++ kind(ctor) returns the kind of the constructor `ctor'. + dualSignature: % -> List Boolean + ++ dualSignature(c) returns a list l of Boolean values with + ++ the following meaning: + ++ l.(i+1) holds when the constructor takes a domain object + ++ as the `i'th argument. Otherwise the argument + ++ must be a non-domain object. + add + kind x == getConstructorKind(x)$Lisp + arity x == getConstructorArity(x)$Lisp + dualSignature x == getDualSignatureFromDB(x)$Lisp +@ + + <<domain CTOR Constructor>>= )abbrev domain CTOR Constructor ++ Author: Gabriel Dos Reis ++ Date Create: October 07, 2008. -++ Date Last Updated: October 07, 2008. +++ Date Last Updated: December 17, 2008. ++ Related Constructors: Domain, Category ++ Basic Operations: name, kind, arity. ++ Description: ++ This domain provides implementations for constructors. -Constructor(): Public == Private where - Public == SetCategory with - name: % -> Identifier - ++ name(ctor) returns the name of the constructor `ctor'. - kind: % -> ConstructorKind - ++ kind(ctor) returns the kind of the constructor `ctor'. - arity: % -> SingleInteger - ++ arity(ctor) returns the arity of the constructor `ctor'. - ++ A negative value means that the ctor takes a variable - ++ length argument list, e.g. Mapping, Record, etc. - Private == add +Constructor(): ConstructorCategory == add Rep == Identifier name x == rep x + kind x == getConstructorKind(x)$Lisp + arity x == getConstructorArity(x)$Lisp +@ + + +\section{domain ConstructorCall} + +<<domain CTORCALL ConstructorCall>>= +import SetCategory +import Symbol +import List Syntax +)abbrev domain CTORCALL ConstructorCall +++ Author: Gabriel Dos Reis +++ Date Created: January 19, 2008 +++ Date Last Updated: July 03, 2008 +++ Description: This domains represents a syntax object that +++ designates a category, domain, or a package. +++ See Also: Syntax, Domain +ConstructorCall(): Public == Private where + Public == SetCategory with + constructor: % -> Constructor + ++ constructor(t) returns the name of the constructor used + ++ to make the call. + arguments: % -> List Syntax + ++ arguments(t) returns the list of syntax objects for the + ++ arguments used to invoke the constructor. + + Private == add + constructor x == + CAR(x)$Lisp + + arguments x == + CDR(x)$Lisp + + x = y == + EQUAL(x,y)$Lisp + + coerce(x: %): OutputForm == + outputDomainConstructor(x)$Lisp +@ + + +<<domain CATCTOR CategoryConstructor>>= +)abbrev domain CATCTOR CategoryConstructor +++ Author: Gabriel Dos Reis +++ Date Create: December 17, 2008. +++ Date Last Updated: December 20, 2008. +++ Related Constructors: Domain, Category +++ Description: +++ This domain provides representations for category constructors. +CategoryConstructor(): Public == Private where + Public == Join(ConstructorCategory, CoercibleTo Constructor) + Private == Constructor add + coerce(x: %): Constructor == rep x + +@ + +<<domain DOMCTOR DomainConstructor>>= +)abbrev domain DOMCTOR DomainConstructor +++ Author: Gabriel Dos Reis +++ Date Create: December 17, 2008. +++ Date Last Updated: December 20, 2008. +++ Related Constructors: Domain, Category +++ Description: +++ This domain provides representations for domains constructors. +DomainConstructor(): Public == Private where + Public == Join(ConstructorCategory, CoercibleTo Constructor) + Private == Constructor add + coerce(x: %): Constructor == rep x + +@ + +\section{The Signature domain} + +<<domain SIG Signature>>= +import List +import Syntax +)abbrev domain SIG Signature +++ Author: Gabriel Dos Reis +++ Date Created: January 10, 2008 +++ Date Last Updated: December 20, 2008 +++ Description: This is the datatype for operation signatures as +++ used by the compiler and the interpreter. Note that this domain +++ differs from SignatureAst. +++ See also: ConstructorCall, Domain. +Signature(): Public == Private where + Public == SetCategory with + signature: (List Syntax,Syntax) -> % + ++ signature(s,t) constructs a Signature object with parameter + ++ types indicaded by `s', and return type indicated by `t'. + target: % -> Syntax + ++ target(s) returns the target type of the signature `s'. + source: % -> List Syntax + ++ source(s) returns the list of parameter types of `s'. + Private == add + Rep == List Syntax + signature(s,t) == per cons(t,s) + target x == first rep x + source x == rest rep x x = y == rep x = rep y - coerce(x: %): OutputForm == rep(x)::OutputForm + printType(x: Syntax): OutputForm == + x::InputForm::OutputForm + coerce(x: %): OutputForm == + #source x = 1 => + rarrow(printType first source x, printType target x) + rarrow(paren [printType s for s in source x], + printType target x)$OutputForm +@ + +\section{A domain for operator signatures} + +<<domain OPSIG OperatorSignature>>= +)abbrev domain OPSIG OperatorSignature +++ Author: Gabriel Dos Reis +++ Date Created: December 20, 2008 +++ Date Last Modified: December 20, 2008 +++ Description: +++ This the datatype for an operator-signature pair. +OperatorSignature(): Public == Private where + Public == OperatorCategory Identifier with + signature: % -> Signature + ++ signature(x) returns the signature of `x'. + construct: (Identifier,Signature) -> % + ++ construct(op,sig) construct a signature-operator with + ++ operator name `op', and signature `sig'. + Private == add + construct(o,s) == LIST(o,s)$Lisp + name x == CAR(x)$Lisp + signature x == CADR(x)$Lisp + x = y == EQUAL(x,y)$Lisp + arity x == (#source signature x)::Arity + coerce(x: %): OutputForm == + infix('_:::OutputForm, name(x)::OutputForm, + signature(x)::OutputForm) + +@ + +\section{The SystemPredicate domain} + +<<domain SYSPRED SystemPredicate>>= +)abbrev domain SYSPRED SystemPredicate +SystemPredicate(): Public == Private where + Public == SetCategory + Private == add + x = y == EQUAL(x,y)$Lisp + coerce(x: %): OutputForm == + NOT(x)$Lisp => '_false::OutputForm + EQ(x,'T)$Lisp => '_true::OutputForm + EQCAR(x,'NOT)$Lisp => not(CADR(x)$Lisp : % :: OutputForm) @ \section{domain Category} <<domain CATEGORY Category>>= import CoercibleTo OutputForm +import CategoryConstructor )abbrev domain CATEGORY Category ++ Author: Gabriel Dos Reis -++ Date Create: February 16, 2008. +++ Date Create: December 20, 2008. ++ Date Last Updated: February 16, 2008. ++ Basic Operations: coerce ++ Related Constructors: ++ Also See: Type Category(): Public == Private where - Public ==> CoercibleTo OutputForm - Private ==> add + Public == CoercibleTo OutputForm with + constructor: % -> CategoryConstructor + ++ constructor(c) returns the category constructor used to + ++ instantiate the category object `c'. + exportedOperators: % -> List OperatorSignature + ++ exportedOperators(c) returns the list of all operator signatures + ++ exported by the category `c', along with their predicates. + principalAncestors: % -> List ConstructorCall + ++ principalAncestors(c) returns the list of all category + ++ forms that are principal ancestors of the the category `c'. + parents: % -> List ConstructorCall + ++ parents(c) returns the list of all category forms directly + ++ extended by the category `c'. + Private == add + constructor x == + CAR(devaluate(x)$Lisp)$Lisp + + exportedOperators c == + [CAR(x)$Lisp@OperatorSignature + for x in getCategoryExports(c)$Lisp@List(Syntax)] + + principalAncestors c == + getCategoryPrincipalAncestors(c)$Lisp + + parents c == + [CAR(x)$Lisp@ConstructorCall + for x in getCategoryParents(c)$Lisp@List(Syntax)] + coerce x == outputDomainConstructor(x)$Lisp @ \section{domain Domain} <<domain DOMAIN Domain>>= -import SetCategory import Void import ConstructorCall +import DomainConstructor )abbrev domain DOMAIN Domain ++ Author: Gabriel Dos Reis ++ Date Create: October 18, 2007. -++ Date Last Updated: January 19, 2008. +++ Date Last Updated: December 20, 2008. ++ Basic Operations: coerce, reify ++ Related Constructors: Type, Syntax, OutputForm ++ Also See: Type, ConstructorCall Domain(): Public == Private where Public == SetCategory with + constructor: % -> DomainConstructor + ++ constructor(d) returns the domain constructor that is + ++ instantiated to the domain object `d'. reify: % -> ConstructorCall ++ reify(d) returns the abstract syntax for the domain `x'. @@ -110,6 +299,9 @@ Domain(): Public == Private where ++ of domain `d'. Private == add + constructor x == + CAR(devaluate(x)$Lisp)$Lisp + coerce x == outputDomainConstructor(x)$Lisp @@ -167,6 +359,14 @@ Domain(): Public == Private where <<license>> <<domain CTORKIND ConstructorKinid>> +<<category CTORCAT ConstructorCategory>> +<<domain CTOR Constructor>> +<<domain CTORCALL ConstructorCall>> +<<domain CATCTOR CategoryConstructor>> +<<domain DOMCTOR DomainConstructor>> + +<<domain SIG Signature>> +<<domain OPSIG OperatorSignature>> <<domain CATEGORY Category>> <<domain DOMAIN Domain>> diff --git a/src/algebra/exposed.lsp.pamphlet b/src/algebra/exposed.lsp.pamphlet index 4193cb77..6240abfa 100644 --- a/src/algebra/exposed.lsp.pamphlet +++ b/src/algebra/exposed.lsp.pamphlet @@ -387,6 +387,7 @@ (|SegmentFunctions2| . SEG2) (|SequenceAst| . SEQAST) (|Set| . SET) + (|Signature| . SIG) (|SignatureAst| . SIGAST) (|SimpleAlgebraicExtensionAlgFactor| . SAEFACT) (|SimplifyAlgebraicNumberConvertPackage| . SIMPAN) @@ -612,6 +613,7 @@ (|CommutativeRing| . COMRING) (|ComplexCategory| . COMPCAT) (|Conduit| . CONDUIT) + (|ConstructorCategory| . CTORCAT) (|ConvertibleFrom| . KVTFROM) (|ConvertibleTo| . KONVERT) (|DequeueAggregate| . DQAGG) diff --git a/src/algebra/outform.spad.pamphlet b/src/algebra/outform.spad.pamphlet index 47486571..fff28e68 100644 --- a/src/algebra/outform.spad.pamphlet +++ b/src/algebra/outform.spad.pamphlet @@ -539,26 +539,26 @@ OutputForm(): SetCategory with right(a) == right(a,width()) vspace(n) == - n = 0 => empty() + n <= 0 => empty() vconcat(sform " ",vspace(n - 1)) hspace(n) == - n = 0 => empty() + n <= 0 => empty() sform(fillerSpaces(n)$Lisp) rspace(n, m) == - n = 0 or m = 0 => empty() + n <= 0 or m <= 0 => empty() vconcat(hspace n, rspace(n, m - 1)) matrix ll == lv := bless [LIST2VEC$Lisp l for l in ll] CONS(eform MATRIX, LIST2VEC$Lisp lv)$Lisp - pile l == cons(eform SC, l) - commaSeparate l == cons(eform AGGLST, l) - semicolonSeparate l == cons(eform AGGSET, l) + pile l == cons(eform 'SC, l) + commaSeparate l == cons(eform 'AGGLST, l) + semicolonSeparate l == cons(eform 'AGGSET, l) blankSeparate l == - c:=eform CONCATB + c:=eform 'CONCATB l1: List % :=[] for u in reverse l repeat if EQCAR(u,c)$Lisp @@ -566,29 +566,30 @@ OutputForm(): SetCategory with else l1:=[u,:l1] cons(c, l1) - brace a == bless [eform BRACE, a] + brace a == bless [eform 'BRACE, a] brace l == brace commaSeparate l - bracket a == bless [eform BRACKET, a] + bracket a == bless [eform 'BRACKET, a] bracket l == bracket commaSeparate l - paren a == bless [eform PAREN, a] + paren a == bless [eform 'PAREN, a] paren l == paren commaSeparate l - sub (a,b) == bless [eform SUB, a, b] - super (a, b) == bless [eform SUPERSUB,a,sform " ",b] - presub(a,b) == bless [eform SUPERSUB,a,sform " ",sform " ",sform " ",b] - presuper(a, b) == bless [eform SUPERSUB,a,sform " ",sform " ",b] + sub (a,b) == bless [eform 'SUB, a, b] + super (a, b) == bless [eform 'SUPERSUB,a,sform " ",b] + presub(a,b) == + bless [eform 'SUPERSUB,a,sform " ",sform " ",sform " ",b] + presuper(a, b) == bless [eform 'SUPERSUB,a,sform " ",sform " ",b] scripts (a, l) == null l => a null rest l => sub(a, first l) - cons(eform SUPERSUB, cons(a, l)) + cons(eform 'SUPERSUB, cons(a, l)) supersub(a, l) == if odd?(#l) then l := append(l, [empty()]) - cons(eform ALTSUPERSUB, cons(a, l)) + cons(eform 'ALTSUPERSUB, cons(a, l)) - hconcat(a,b) == bless [eform CONCAT, a, b] - hconcat l == cons(eform CONCAT, l) - vconcat(a,b) == bless [eform VCONCAT, a, b] - vconcat l == cons(eform VCONCAT, l) + hconcat(a,b) == bless [eform 'CONCAT, a, b] + hconcat l == cons(eform 'CONCAT, l) + vconcat(a,b) == bless [eform 'VCONCAT, a, b] + vconcat l == cons(eform 'VCONCAT, l) (a:% ~= b:%): % == bless [sform "~=", a, b] a < b == bless [sform "<", a, b] @@ -609,11 +610,11 @@ OutputForm(): SetCategory with a and b == bless [sform "and", a, b] a or b == bless [sform "or", a, b] not a == bless [sform "not", a] - SEGMENT(a,b)== bless [eform SEGMENT, a, b] - SEGMENT(a) == bless [eform SEGMENT, a] - binomial(a,b)== bless [eform BINOMIAL, a, b] + SEGMENT(a,b)== bless [eform 'SEGMENT, a, b] + SEGMENT(a) == bless [eform 'SEGMENT, a] + binomial(a,b)== bless [eform 'BINOMIAL, a, b] - empty() == bless [eform NOTHING] + empty() == bless [eform 'NOTHING] infix? a == e:$ := @@ -638,25 +639,25 @@ OutputForm(): SetCategory with postfix(a, b) == hconcat(b, a) - string a == bless [eform STRING, a] - quote a == bless [eform QUOTE, a] - overbar a == bless [eform OVERBAR, a] + string a == bless [eform 'STRING, a] + quote a == bless [eform 'QUOTE, a] + overbar a == bless [eform 'OVERBAR, a] dot a == super(a, sform ".") prime a == super(a, sform ",") dot(a,nn) == (s := new(nn, char "."); super(a, sform s)) prime(a,nn) == (s := new(nn, char ","); super(a, sform s)) - overlabel(a,b) == bless [eform OVERLABEL, a, b] - box a == bless [eform BOX, a] - zag(a,b) == bless [eform ZAG, a, b] - root a == bless [eform ROOT, a] - root(a,b) == bless [eform ROOT, a, b] - over(a,b) == bless [eform OVER, a, b] - slash(a,b) == bless [eform SLASH, a, b] - assign(a,b)== bless [eform LET, a, b] - - label(a,b) == bless [eform EQUATNUM, a, b] - rarrow(a,b)== bless [eform TAG, a, b] + overlabel(a,b) == bless [eform 'OVERLABEL, a, b] + box a == bless [eform 'BOX, a] + zag(a,b) == bless [eform 'ZAG, a, b] + root a == bless [eform 'ROOT, a] + root(a,b) == bless [eform 'ROOT, a, b] + over(a,b) == bless [eform 'OVER, a, b] + slash(a,b) == bless [eform 'SLASH, a, b] + assign(a,b)== bless [eform '%LET, a, b] + + label(a,b) == bless [eform 'EQUATNUM, a, b] + rarrow(a,b)== bless [eform 'RARROW, a, b] differentiate(a, nn)== zero? nn => a nn < 4 => prime(a, nn) @@ -664,15 +665,15 @@ OutputForm(): SetCategory with s := lowerCase(r::String) super(a, paren sform s) - sum(a) == bless [eform SIGMA, empty(), a] - sum(a,b) == bless [eform SIGMA, b, a] - sum(a,b,c) == bless [eform SIGMA2, b, c, a] - prod(a) == bless [eform PI, empty(), a] - prod(a,b) == bless [eform PI, b, a] - prod(a,b,c)== bless [eform PI2, b, c, a] - int(a) == bless [eform INTSIGN,empty(), empty(), a] - int(a,b) == bless [eform INTSIGN,b, empty(), a] - int(a,b,c) == bless [eform INTSIGN,b, c, a] + sum(a) == bless [eform 'SIGMA, empty(), a] + sum(a,b) == bless [eform 'SIGMA, b, a] + sum(a,b,c) == bless [eform 'SIGMA2, b, c, a] + prod(a) == bless [eform 'PI, empty(), a] + prod(a,b) == bless [eform 'PI, b, a] + prod(a,b,c)== bless [eform 'PI2, b, c, a] + int(a) == bless [eform 'INTSIGN,empty(), empty(), a] + int(a,b) == bless [eform 'INTSIGN,b, empty(), a] + int(a,b,c) == bless [eform 'INTSIGN,b, c, a] @ diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index ca967397..382a9227 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -40,7 +40,7 @@ import SExpression Syntax(): Public == Private where Public == Join(UnionType, SetCategory, RetractableTo Integer, RetractableTo DoubleFloat, RetractableTo Symbol, - RetractableTo String) with + RetractableTo String, CoercibleTo InputForm) with convert: % -> SExpression ++ convert(s) returns the s-expression representation of a syntax. @@ -218,80 +218,12 @@ Syntax(): Public == Private where getOperands x == atom? x => [] CDR(x)$Lisp -@ - - -\section{domain ConstructorCall} - -<<domain CTORCALL ConstructorCall>>= -import SetCategory -import Symbol -import List Syntax -)abbrev domain CTORCALL ConstructorCall -++ Author: Gabriel Dos Reis -++ Date Created: January 19, 2008 -++ Date Last Updated: July 03, 2008 -++ Description: This domains represents a syntax object that -++ designates a category, domain, or a package. -++ See Also: Syntax, Domain -ConstructorCall(): Public == Private where - Public == SetCategory with - constructorName: % -> Symbol - ++ constructorName c returns the name of the constructor - arguments: % -> List Syntax - ++ arguments returns the list of syntax objects for the - ++ arguments used to invoke the constructor. - - Private == add - Rep == List Syntax - - constructorName x == - (first rep x)::Symbol - arguments x == - rest rep x - - x = y == - rep x = rep y - - coerce x == - outputDomainConstructor(x)$Lisp + coerce(x: %): InputForm == + x : InputForm @ -\section{The Signature domain} -<<domain SIG Signature>>= -import SetCategory -import CoercibleTo -import List -import Syntax -)abbrev domain SIG Signature -++ Author: Gabriel Dos Reis -++ Date Created: January 10, 2008 -++ Date Last Updated: August 30, 2008 -++ Description: This is the datatype for operation signatures as -++ used by the compiler and the interpreter. Note that this domain -++ differs from SignatureAst. -++ See also: ConstructorCall, Domain. -Signature(): Public == Private where - Public == SetCategory with - signature: (List Syntax,Syntax) -> % - ++ signature(s,t) constructs a Signature object with parameter - ++ types indicaded by `s', and return type indicated by `t'. - target: % -> Syntax - ++ target(s) returns the target type of the signature `s'. - source: % -> List Syntax - ++ source(s) returns the list of parameter types of `s'. - Private == add - Rep == List Syntax - signature(s,t) == per cons(t,s) - target x == first rep x - source x == rest rep x - x = y == rep x = rep y - coerce(x: %): OutputForm == - rarrow([s::OutputForm for s in source x]::OutputForm, - target(x)::OutputForm)$OutputForm -@ \section{domain ElaboratedExpression} @@ -615,15 +547,20 @@ Literal(T: SetCategory): Public == Private where <<domain IDENT Identifier>>= ++ Author: Gabriel Dos Reis ++ Date Created: July 5, 2008 -++ Date Last Modified: September 1, 2008 -++ Description: This domain represents identifer AST. +++ Date Last Modified: December 17, 2008 +++ Description: +++ This domain represents identifer AST. +++ This domain differs from Symbol in that it does not support +++ any form of scripting. +++ A value of this domain is a plain old identifier. +++ )abbrev domain IDENT Identifier Identifier(): Public == Private where - Public == Join(SpadSyntaxCategory, CoercibleTo Symbol) + Public == Join(SetCategory, CoercibleTo Symbol) Private == add - Rep == Symbol - coerce(x: %): Symbol == rep x - coerce(x: %): OutputForm == x::Symbol::OutputForm + x = y == EQ(x,y)$Lisp + coerce(x: %): Symbol == x : Symbol + coerce(x: %): OutputForm == x : OutputForm @ @@ -1788,8 +1725,6 @@ SpadAst(): SpadAstExports() == add <<*>>= <<license>> <<domain SYNTAX Syntax>> -<<domain SIG Signature>> -<<domain CTORCALL ConstructorCall>> <<domain ELABEXPR ElaboratedExpression>> <<category ASTCAT AbstractSyntaxCategory>> diff --git a/src/algebra/term.spad.pamphlet b/src/algebra/term.spad.pamphlet index 532bd720..ff88acfe 100644 --- a/src/algebra/term.spad.pamphlet +++ b/src/algebra/term.spad.pamphlet @@ -58,7 +58,7 @@ Arity(): Public == Private where )abbrev category OPERCAT OperatorCategory ++ Author: Gabriel Dos Reis ++ Date Created: December 04, 2008 -++ Date Last Updated: December 04, 2008 +++ Date Last Updated: December 17, 2008 ++ Description: ++ This category specifies the interface for operators used to build ++ terms, in the sense of Universal Algebra. The domain parameter S @@ -69,12 +69,6 @@ OperatorCategory(S: SetCategory): Category == ++ name(op) returns the externam name of `op'. arity: % -> Arity ++ arity(op) returns the arity of the operator `op'. - operator: S -> % - ++ operator(s) returns an operator object with external name `s', - ++ and of arbitrary arity. - operator: (S,NonNegativeInteger) -> % - ++ operator(s,n) returns an operator object with external - ++ name `s', and of arity `n'. add coerce(op: %): OutputForm == name(op)::OutputForm |