From b470f6e697d62ac77ea6c880d7199de801988ba7 Mon Sep 17 00:00:00 2001 From: dos-reis Date: Thu, 18 Sep 2008 03:16:31 +0000 Subject: * interp/g-util.boot (getTypeOfSyntax): Infer more syntax domains. * algebra/syntax.spad.pamphlet: Add more syntax domains. * algebra/exposed.lsp.pamphlet: Expose more syntax object domains. * algebra/Makefile.pamphlet (axiom_algebra_layer_user): Add more syntax object files. --- src/ChangeLog | 8 + src/algebra/Makefile.in | 12 +- src/algebra/Makefile.pamphlet | 12 +- src/algebra/exposed.lsp.pamphlet | 16 ++ src/algebra/syntax.spad.pamphlet | 369 ++++++++++++++++++++++++++++++++++++++- src/interp/g-util.boot | 10 ++ 6 files changed, 410 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/ChangeLog b/src/ChangeLog index 4deded32..d9a2fe40 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2008-09-17 Gabriel Dos Reis + + * interp/g-util.boot (getTypeOfSyntax): Infer more syntax domains. + * algebra/syntax.spad.pamphlet: Add more syntax domains. + * algebra/exposed.lsp.pamphlet: Expose more syntax object domains. + * algebra/Makefile.pamphlet (axiom_algebra_layer_user): Add more + syntax object files. + 2008-09-14 Gabriel Dos Reis * algebra/net.spad.pamphlet (Conduit): New. diff --git a/src/algebra/Makefile.in b/src/algebra/Makefile.in index 0facef02..6c8fcb4e 100644 --- a/src/algebra/Makefile.in +++ b/src/algebra/Makefile.in @@ -819,11 +819,13 @@ axiom_algebra_layer_23_objects = \ $(addprefix $(OUT)/, \ $(addsuffix .$(FASLEXT),$(axiom_algebra_layer_23))) axiom_algebra_layer_user = \ - RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ - LITERAL IDENT TYPEAST IMPTAST MAPPAST ATTRAST \ - JOINAST IFAST RPTAST WHILEAST INAST CLLCAST \ - LSTAST EXITAST RETAST SEGAST PRTDAST CRCAST \ - LETAST + RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ + LITERAL IDENT 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 axiom_algebra_layer_user_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_user)) diff --git a/src/algebra/Makefile.pamphlet b/src/algebra/Makefile.pamphlet index 170c5cab..f0518711 100644 --- a/src/algebra/Makefile.pamphlet +++ b/src/algebra/Makefile.pamphlet @@ -1246,11 +1246,13 @@ Rather than classify newly created algebra into the existing type lattice we add it here. <>= axiom_algebra_layer_user = \ - RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ - LITERAL IDENT TYPEAST IMPTAST MAPPAST ATTRAST \ - JOINAST IFAST RPTAST WHILEAST INAST CLLCAST \ - LSTAST EXITAST RETAST SEGAST PRTDAST CRCAST \ - LETAST + RINTERP ASTCAT ASTCAT- SASTCAT SASTCAT- HEADAST \ + LITERAL IDENT 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 axiom_algebra_layer_user_nrlibs = \ $(addsuffix .NRLIB/code.$(FASLEXT),$(axiom_algebra_layer_user)) diff --git a/src/algebra/exposed.lsp.pamphlet b/src/algebra/exposed.lsp.pamphlet index a4b5a8c4..da109105 100644 --- a/src/algebra/exposed.lsp.pamphlet +++ b/src/algebra/exposed.lsp.pamphlet @@ -51,6 +51,7 @@ '( ;;define the groups |basic| |naglink| |anna| |categories| |Hidden| |defaults| (|basic| + (|AddAst| . ADDAST) (|AlgebraicManipulations| . ALGMANIP) (|AlgebraicNumber| . AN) (|AlgFactor| . ALGFACT) @@ -76,14 +77,19 @@ (|Boolean| . BOOLEAN) (|Byte| . BYTE) (|ByteArray| . BYTEARY) + (|CallAst| . CALLAST) + (|CapsuleAst| . CAPSLAST) (|CardinalNumber| . CARD) (|CartesianTensor| . CARTEN) (|CartesianTensorFunctions2| . CARTEN2) + (|CaseAst| . CASEAST) + (|CategoryAst| . CATAST) (|Character| . CHAR) (|CharacterClass| . CCLASS) (|CharacteristicPolynomialPackage| . CHARPOL) (|CliffordAlgebra| . CLIF) (|Color| . COLOR) + (|CommaAst| . COMMAAST) (|CommonDenominator| . CDEN) (|Commutator| . COMM) (|Complex| . COMPLEX) @@ -91,6 +97,7 @@ (|ComplexFunctions2| . COMPLEX2) (|ComplexRootPackage| . CMPLXRT) (|ComplexTrigonometricManipulations| . CTRIGMNP) + (|ColonAst| . COLONAST) (|ConstructorCall| . CTORCALL) (|ContinuedFraction| . CONTFRAC) (|Contour| . CONTOUR) @@ -101,6 +108,7 @@ (|DataBuffer| . DATABUF) (|DataList| . DLIST) (|DecimalExpansion| . DECIMAL) + (|DefinitionAst| . DEFAST) (|DenavitHartenbergMatrix| . DHMATRIX) (|Dequeue| . DEQUEUE) (|DiophantineSolutionPackage| . DIOSP) @@ -170,6 +178,7 @@ (|GroebnerPackage| . GB) (|GroebnerFactorizationPackage| . GBF) (|HallBasis| . HB) + (|HasAst| . HASAST) (|HeadAst| . HEADAST) (|Heap| . HEAP) (|HexadecimalExpansion| . HEXADEC) @@ -200,11 +209,13 @@ (|InventorRenderPackage| . IVREND) (|InverseLaplaceTransform| . INVLAPLA) (|IrrRepSymNatPackage| . IRSN) + (|IsAst| . ISAST) (|JavaBytecode| . JAVACODE) (|KernelFunctions2| . KERNEL2) (|KeyedAccessFile| . KAFILE) (|LaplaceTransform| . LAPLACE) (|LazardMorenoSolvingPackage| . LAZM3PK) + (|LetAst| . LETAST) (|Library| . LIB) (|LieSquareMatrix| . LSQM) (|LinearOrdinaryDifferentialOperator| . LODO) @@ -216,6 +227,7 @@ (|ListFunctions3| . LIST3) (|ListToMap| . LIST2MAP) (|Literal| . LITERAL) + (|MacroAst| . MACROAST) (|MakeFloatCompiledFunction| . MKFLCFN) (|MakeFunction| . MKFUNC) (|MakeRecord| . MKRECORD) @@ -312,6 +324,7 @@ (|PropositionalFormula| . PROPFRML) (|QuadraticForm| . QFORM) (|QuasiComponentPackage| . QCMPACK) + (|QuasiquoteAst| . QQUTAST) (|Quaternion| . QUAT) (|QuaternionCategoryFunctions2| . QUATCT2) (|QueryEquation| . QEQUAT) @@ -350,9 +363,11 @@ (|ScriptFormulaFormat| . FORMULA) (|ScriptFormulaFormat1| . FORMULA1) (|Segment| . SEG) + (|SegmentAst| . SEGAST) (|SegmentBinding| . SEGBIND) (|SegmentBindingFunctions2| . SEGBIND2) (|SegmentFunctions2| . SEG2) + (|SequenceAst| . SEQAST) (|Set| . SET) (|SimpleAlgebraicExtensionAlgFactor| . SAEFACT) (|SimplifyAlgebraicNumberConvertPackage| . SIMPAN) @@ -372,6 +387,7 @@ (|StreamFunctions3| . STREAM3) (|String| . STRING) (|SturmHabichtPackage| . SHP) + (|SuchThatAst| . SUCHTAST) (|Symbol| . SYMBOL) (|SymmetricGroupCombinatoricFunctions| . SGCF) (|Syntax| . SYNTAX) diff --git a/src/algebra/syntax.spad.pamphlet b/src/algebra/syntax.spad.pamphlet index bd430752..04018708 100644 --- a/src/algebra/syntax.spad.pamphlet +++ b/src/algebra/syntax.spad.pamphlet @@ -428,7 +428,7 @@ SpadSyntaxCategory(): Category == AbstractSyntaxCategory renderWhile(x: List Syntax): OutputForm == elt('WhileAst::OutputForm, - ['condition::OutputForm = renderSyntax(x : Syntax)])$OutputForm + ['condition::OutputForm = renderSyntax first x])$OutputForm renderIn(x: List Syntax): OutputForm == elt('InAst::OutputForm, @@ -471,6 +471,42 @@ SpadSyntaxCategory(): Category == AbstractSyntaxCategory ['lhs::OutputForm = renderSyntax first x, 'rhs::OutputForm = renderSyntax second x])$OutputForm + renderSuchThat(x: List Syntax): OutputForm == + elt('SuchThatAst::OutputForm, + ['predicate::OutputForm = renderSyntax first x])$OutputForm + + renderColon(x: List Syntax): OutputForm == + elt('ColonAst::OutputForm, + ['lhs::OutputForm = renderSyntax first x, + 'rhs::OutputForm = renderSyntax second x])$OutputForm + + renderCapsule(x: List Syntax): OutputForm == + elt('CapsuleAst::OutputForm, + ['body::OutputForm = + [renderSyntax s for s in x]::List(OutputForm)::OutputForm]) + + renderBinaryExpr(op: Symbol, args: List Syntax): OutputForm == + elt(op::OutputForm, + ['lhs::OutputForm = renderSyntax first args, + 'rhs::OutputForm = renderSyntax second args])$OutputForm + + renderCategory(x: List Syntax): OutputForm == + elt('CategoryAst::OutputForm, + ['kind::OutputForm = renderSyntax first x, + 'body::OutputForm = + [renderSyntax s for s in x]::List(OutputForm)::OutputForm]) + + renderDefinition(x: List Syntax): OutputForm == + elt('DefinitionAst::OutputForm, + ['head::OutputForm = renderSyntax first x, + 'signature::OutputForm = renderSyntax second x, + 'body::OutputForm = renderSyntax last x])$OutputForm + + renderMacro(x: List Syntax): OutputForm == + elt('MacroAst::OutputForm, + ['head::OutputForm = renderSyntax first x, + 'body::OutputForm = renderSyntax last x])$OutputForm + renderSyntax x == compound? x => op := getOperator x @@ -493,6 +529,15 @@ SpadSyntaxCategory(): Category == AbstractSyntaxCategory op = 'SEGMENT => renderSegment args op = 'SEQ => renderSequence args op = '%LET => renderLet args + op = '_| => renderSuchThat args + op = '_: => renderColon args + op = 'CAPSULE => renderCapsule args + op = '_case => renderBinaryExpr('CaseAst, args) + op = '_has => renderBinaryExpr('HasAst, args) + op = '_is => renderBinaryExpr('IsAst, args) + op = 'CATEGORY => renderCategory args + op = 'DEF => renderDefinition args + op = 'MDEF => renderMacro args x::OutputForm x::OutputForm @@ -826,6 +871,27 @@ CollectAst(): Public == Private where @ +\subsection{The ReduceAst domain} + +<>= +)abbrev domain RDUCEAST ReduceAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: August 30, 2008 +++ Description: This domain represents list reduction syntax. +ReduceAst(): Public == Private where + Public == SpadSyntaxCategory with + operator: % -> Syntax + ++ operator(e) returns the magma operation being applied. + body: % -> Syntax + ++ body(e) return the list of expressions being redcued. + Private == add + Rep == List Syntax + operator x == second rep x + body x == third rep x + +@ + \subsection{The ConstructAst domain} <>= @@ -859,15 +925,15 @@ ExitAst(): Public == Private where Public == SpadSyntaxCategory with expression: % -> Syntax ++ expression(e) returns the exit expression of `e'. + level: % -> Integer + ++ level(e) returns the nesting exit level of `e' Private == add - import Pair - Rep == Pair(Symbol,Syntax) - expression x == second rep x - + Rep == List Syntax + expression x == third rep x + level x == (second rep x) : Integer @ - \subsection{The ReturnAst domain} <>= @@ -1025,11 +1091,14 @@ CallAst(): Public == Private where )abbrev domain SEGAST SegmentAst ++ Author: Gabriel Dos Reis ++ Date Created: November 10, 2007 -++ Date Last Modified: August 30, 2008 +++ Date Last Modified: September 17, 2008 ++ Description: This domain represents segement expressions. SegmentAst(): Public == Private where Public == SpadSyntaxCategory with bounds: % -> List Syntax + ++ bounds(s) returns the bounds of the segment `s'. If + ++ `s' designates an infinite interval, then the returns + ++ list a singleton list. Private == add Rep == List Syntax bounds x == rest rep x @@ -1037,6 +1106,277 @@ SegmentAst(): Public == Private where @ +\subsection{The SuchThatAst domain} + +<>= +)abbrev domain SUCHTAST SuchThatAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents the filter iterator syntax. +SuchThatAst(): Public == Private where + Public == SpadSyntaxCategory with + predicate: % -> Syntax + ++ predicate(e) returns the syntax object for the predicate + ++ in the filter iterator syntax `e'. + Private == add + Rep == List Syntax + predicate e == second rep x +@ + +\subsection{The ColonAst domain} + +<>= +)abbrev domain COLONAST ColonAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents type specification +++ for an identifier or expression. +ColonAst(): Public == Private where + Public == SpadSyntaxCategory with + lhs: % -> Syntax + ++ lhs(e) returns the left hand side of the colon expression `e'. + rhs: % -> TypeAst + ++ rhs(e) returns the right hand side of the colon expression `e'. + Private == add + Rep == List Syntax + lhs x == second rep x + rhs x == (third rep x) : TypeAst +@ + +\subsection{The AddAst domain} + +<>= +)abbrev domain ADDAST AddAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents the syntax for an add-expression. +AddAst(): Public == Private where + Public == SpadSyntaxCategory with + base: % -> Syntax + ++ base(d) returns the base domain(s) of the add-domain expression. + body: % -> Syntax + ++ base(d) returns the actual body of the add-domain expression `d'. + Private == add + Rep == List Syntax + base x == second rep x + body x == third rep x +@ + + +\subsection{The CapsuleAst domain} + +<>= +)abbrev domain CAPSLAST CapsuleAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents the capsule of a domain definition. +CapsuleAst(): Public == Private where + Public == SpadSyntaxCategory with + body: % -> List Syntax + ++ body(c) returns the list of top level expressions appearing in `c'. + Private == add + Rep == Pair(Symbol, List Syntax) + body x == second rep x +@ + +\subsection{The CaseAst domain} + +<>= +)abbrev domain CASEAST CaseAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents a `case' expression. +CaseAst(): Public == Private where + Public == SpadSyntaxCategory with + lhs: % -> Syntax + ++ lhs(e) returns the left hand side of the case expression `e'. + rhs: % -> Syntax + ++ rhs(e) returns the right hand side of the case expression `e'. + Private == add + Rep == List Syntax + lhs x == second rep x + rhs x == third rep x +@ + + +\subsection{The HasAst domain} + +<>= +)abbrev domain HASAST HasAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents a `has' expression. +HasAst(): Public == Private where + Public == SpadSyntaxCategory with + lhs: % -> Syntax + ++ lhs(e) returns the left hand side of the has expression `e'. + rhs: % -> Syntax + ++ rhs(e) returns the right hand side of the case expression `e'. + Private == add + Rep == List Syntax + lhs x == second rep x + rhs x == third rep x +@ + +\subsection{The IsAst domain} + +<>= +)abbrev domain ISAST IsAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents a `has' expression. +IsAst(): Public == Private where + Public == SpadSyntaxCategory with + lhs: % -> Syntax + ++ lhs(e) returns the left hand side of the is expression `e'. + rhs: % -> Syntax + ++ rhs(e) returns the right hand side of the is expression `e'. + Private == add + Rep == List Syntax + lhs x == second rep x + rhs x == third rep x +@ + +\subsection{The CategoryAst domain} + +<>= +)abbrev domain CATAST CategoryAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 17, 2008 +++ Description: This domain represents the unnamed category defined +++ by a list of exported signatures +CategoryAst(): Public == Private where + Public == SpadSyntaxCategory with + kind: % -> Symbol + ++ kind(c) returns the kind of unnamed category, either + ++ 'domain' or 'package'. + body: % -> List Syntax + ++ body(c) returns the list of exports in category syntax `c'. + Private == add + Rep == List Syntax + kind x == second rep x + body x == rest rest rep x +@ + +\subsection{The WhereAst domain} + +<>= +)abbrev domain WHEREAST WhereAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 18, 2008 +++ Description: This domain represents the syntax of a `where' expression. +WhereAst(): Public == Private where + Public == SpadSyntaxCategory with + mainExpression: % -> Syntax + ++ mainExpression(e) returns the main expression of the + ++ `where' expression `e'. + qualifier: % -> Syntax + ++ qualifier(e) returns the qualifier of the expression `e'. + Private == add + Rep == List Syntax + mainExpression x == second rep x + qualifier x == third rep x +@ + +\subsection{The CommaAst domain} + +<>= +)abbrev domain COMMAAST CommaAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 18, 2008 +++ Description: This domain represents the syntax of a comma-separated +++ list of expressions. +CommaAst(): Public == Private where + Public == SpadSyntaxCategory with + body: % -> List Syntax + ++ body(e) returns the list of expressions making up `e'. + Private == add + Rep == List Syntax + body x == rest rep x +@ + + +\subsection{The QuasiquoteAst domain} + +<>= +)abbrev domain QQUTAST QuasiquoteAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 18, 2008 +++ Description: This domain represents the syntax of a quasiquote +++ expression. +QuasiquoteAst(): Public == Private where + Public == SpadSyntaxCategory with + expression: % -> Syntax + ++ expression(e) returns the syntax for the expression being quoted. + Private == add + Rep == List Syntax + expression x == second rep x +@ + + +\subsection{The DefinitionAst domain} + +<>= +)abbrev domain DEFAST DefinitionAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 18, 2008 +++ Description: This domain represents the syntax of a definition. +DefinitionAst(): Public == Private where + Public == SpadSyntaxCategory with + head: % -> List Identifier + ++ head(d) returns the head of the definition `d'. This is a + ++ list of identifiers starting with the name of the operation + ++ followed by the name of the parameters, if any. + signature: % -> Signature + ++ signature(d) returns the signature of the operation being + ++ defined. Note that this list may be partial in that it + ++ contains only the types actually specified in the definition. + body: % -> Syntax + ++ body(d) returns the right hand side of the definition `d'. + Private == add + Rep == List Syntax + head x == (second rep x) : List Identifier + signature x == (third rep x) : Signature + body x == last rep x + +@ + + +\subsection{The MacroAst domain} + +<>= +)abbrev domain MACROAST MacroAst +++ Author: Gabriel Dos Reis +++ Date Created: November 10, 2007 +++ Date Last Modified: September 18, 2008 +++ Description: This domain represents the syntax of a macro definition. +MacroAst(): Public == Private where + Public == SpadSyntaxCategory with + head: % -> List Identifier + ++ head(m) returns the head of the macro definition `m'. This is a + ++ list of identifiers starting with the name of the macro + ++ followed by the name of the parameters, if any. + body: % -> Syntax + ++ body(m) returns the right hand side of the definition `m'. + Private == add + Rep == List Syntax + head x == (second rep x) : List Identifier + body x == last rep x + +@ + \section{License} @@ -1107,6 +1447,21 @@ SegmentAst(): Public == Private where <> <> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> +<> + @ \end{document} diff --git a/src/interp/g-util.boot b/src/interp/g-util.boot index 6d3fe39f..220518ee 100644 --- a/src/interp/g-util.boot +++ b/src/interp/g-util.boot @@ -145,6 +145,16 @@ getTypeOfSyntax t == op = "::" => '(CoerceAst) op = "@" => '(RestrictAst) op = "%LET" => '(LetAst) + op = "|" => '(SuchThatAst) + op = ":" => '(ColonAst) + op = "CAPSULE" => '(CapsuleAst) + op = "case" => '(CaseAst) + op = "has" => '(HasAst) + op = "is" => '(IsAst) + op = "CATEGORY" => '(CategoryAst) + op = "DEF" => '(DefinitionAst) + op = "MDEF" => '(MacroAst) + op in '(ATTRIBUTE %Attribute) => '(AttributeAst) $Syntax --% -- cgit v1.2.3