public class Comprehension extends ProtoExpression
[op,id] { e | q1, ..., qn }
where [op,id] define a monoid, e is an expression, and the
qis are qualifiers. A qualifier is either a boolean
expression or a pair p <- e, where p is a pattern (any expression)
and e is an expression. The sequence of qualifiers may also be empty. Such a
monoid comprehension is syntactic sugar that is in fact translated into a combination
of homomorphisms and/or filtering tests, possibly wrapped inside a let factoring out
some computation.| Modifier and Type | Class and Description |
|---|---|
static class |
Comprehension.IndexedExpression |
class |
Comprehension.Qualifier |
class |
Comprehension.RawInfo |
| Modifier and Type | Field and Description |
|---|---|
boolean |
_doLetWrapping |
static boolean |
OPAQUE_PARAMETERS |
VOID_ASSIGNMENTS| Constructor and Description |
|---|
Comprehension(java.util.AbstractList parameters,
java.util.AbstractList values,
Expression body)
Constructs an already translated comprehension as a let.
|
Comprehension(Tables tables,
Expression operation,
Expression identity,
Expression expression,
java.util.AbstractList patterns,
java.util.AbstractList expressions)
Constructs a raw comprehension with the specifed arguments and assuming
the default in-place mode for performing the monoid operation.
|
Comprehension(Tables tables,
Expression operation,
Expression identity,
Expression expression,
java.util.AbstractList patterns,
java.util.AbstractList expressions,
byte inPlace)
Constructs a raw comprehension with the specifed arguments.
|
| Modifier and Type | Method and Description |
|---|---|
void |
compile(Compiler compiler)
This method compiles this expression in the context of the specified
Compiler.
|
Expression |
copy()
Returns a deep copy of this expression.
|
Expression |
identity() |
int |
numberOfSubexpressions()
Returns the number of subexpressions
|
Expression |
operation() |
Expression |
sanitizeNames(ParameterStack parameters)
This method returns the actual expression corresponding to this one after
eliminating all the Dummy expressions that occur
in it where names where read.
|
void |
sanitizeSorts(Enclosure enclosure)
|
void |
setCheckedType()
This method sets the final unambiguously checked type of this expression, possibly
along with other final information that may be needed by the compiler for
generating code.
|
Comprehension |
setNoLetWrapping() |
Expression |
setSubexpression(int n,
Expression expression)
Returns this expression after setting its n-th subexpression to the specified
expression; if there is no subexpression at the given position, this throws a
NoSuchSubexpressionException
|
Expression |
subexpression(int n)
Returns the n-th subexpression of this expression; if there is no subexpression
at the given position, this throws a NoSuchSubexpressionException
|
Expression |
substitute(java.util.HashMap substitution)
Returns the comprehension obtained after applying the specified substitution
to the subexpressions of this.
|
Tables |
tables() |
java.lang.String |
toString() |
void |
typeCheck(TypeChecker typeChecker)
This method type-checks this expression in the context of the specified
TypeChecker.
|
Expression |
typedCopy()
Returns a deep copy of this expression this and all its subexpressions share the
same type as their copy's counterparts.
|
checkedType, setCheckedType, setType, type, typeRefaddType, addTypes, boxSort, containsFreeName, enclosingScope, extent, getEnd, getStart, isConstant, isEquality, isFalse, isHiddenSlicing, isNull, isSelector, isSlicing, isTrue, isVoid, locationString, otherTypes, parameters, setCheckedTypeLocked, setEnd, setExtent, setOtherTypes, setStart, shiftOffsets, shiftOffsets, sort, typeCheck, typeCheck, typeCheckLockedpublic static boolean OPAQUE_PARAMETERS
public boolean _doLetWrapping
public Comprehension(java.util.AbstractList parameters,
java.util.AbstractList values,
Expression body)
public Comprehension(Tables tables, Expression operation, Expression identity, Expression expression, java.util.AbstractList patterns, java.util.AbstractList expressions)
public Comprehension(Tables tables, Expression operation, Expression identity, Expression expression, java.util.AbstractList patterns, java.util.AbstractList expressions, byte inPlace)
public final Comprehension setNoLetWrapping()
public final Tables tables()
public final Expression operation()
public final Expression identity()
public final Expression copy()
Expressioncopy in class Expressionpublic final Expression typedCopy()
ExpressiontypedCopy in class Expressionpublic final int numberOfSubexpressions()
ExpressionnumberOfSubexpressions in class Expressionpublic final Expression subexpression(int n) throws NoSuchSubexpressionException
Expressionsubexpression in class ExpressionNoSuchSubexpressionExceptionpublic final Expression setSubexpression(int n, Expression expression) throws NoSuchSubexpressionException
ExpressionsetSubexpression in class ExpressionNoSuchSubexpressionExceptionpublic final Expression sanitizeNames(ParameterStack parameters)
ExpressionsanitizeNames in class Expressionpublic final void sanitizeSorts(Enclosure enclosure)
ExpressionsanitizeSorts in class Expressionpublic Expression substitute(java.util.HashMap substitution)
substitute in class Expressionpublic final void setCheckedType()
ExpressionsetCheckedType in class Expressionpublic final void typeCheck(TypeChecker typeChecker) throws TypingErrorException
ExpressiontypeCheck in class ExpressionTypingErrorExceptionpublic final void compile(Compiler compiler)
Expressioncompile in class Expressionpublic final java.lang.String toString()
toString in class java.lang.Object