Package it.unive.lisa.symbolic
Class SymbolicExpression
- java.lang.Object
-
- it.unive.lisa.symbolic.SymbolicExpression
-
- Direct Known Subclasses:
HeapExpression,ValueExpression
public abstract class SymbolicExpression extends java.lang.ObjectA symbolic expression that can be evaluated bySemanticDomains.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedSymbolicExpression(ExternalSet<Type> types, CodeLocation location)Builds the symbolic expression.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract <T> Taccept(ExpressionVisitor<T> visitor, java.lang.Object... params)Accepts anExpressionVisitor, visiting this expression recursively.booleanequals(java.lang.Object obj)CodeLocationgetCodeLocation()Yields the code location of the statement that has generated this symbolic expression.TypegetDynamicType()Yields the dynamic type of this expression, that is, the most specific common supertype of all its runtime types (available throughgetTypes().ExternalSet<Type>getTypes()Yields the runtime types of this expression.inthashCode()abstract SymbolicExpressionpopScope(ScopeToken token)Pops the scope identified by the given token from the expression.abstract SymbolicExpressionpushScope(ScopeToken token)Pushes a new scope, identified by the give token, in the expression.abstract java.lang.StringtoString()
-
-
-
Constructor Detail
-
SymbolicExpression
protected SymbolicExpression(ExternalSet<Type> types, CodeLocation location)
Builds the symbolic expression.- Parameters:
types- the runtime types of this expressionlocation- the code location of the statement that has generated this expression
-
-
Method Detail
-
getTypes
public final ExternalSet<Type> getTypes()
Yields the runtime types of this expression.- Returns:
- the runtime types
-
getDynamicType
public final Type getDynamicType()
Yields the dynamic type of this expression, that is, the most specific common supertype of all its runtime types (available throughgetTypes().- Returns:
- the dynamic type of this expression
-
pushScope
public abstract SymbolicExpression pushScope(ScopeToken token) throws SemanticException
Pushes a new scope, identified by the give token, in the expression. This causes allVariables to becomeOutOfScopeIdentifiers associated with the given token.- Parameters:
token- the token identifying the scope to push- Returns:
- a copy of this expression where the local variables have gone out of scope
- Throws:
SemanticException- if an error occurs during the computation
-
popScope
public abstract SymbolicExpression popScope(ScopeToken token) throws SemanticException
Pops the scope identified by the given token from the expression. This causes all the invisible variables (i.e.OutOfScopeIdentifiers) mapped to the given scope to become visible (i.e.Variables) again.- Parameters:
token- the token of the scope to be restored- Returns:
- a copy of this expression where the local variables associated with the given scope are visible again
- Throws:
SemanticException- if an error occurs during the computation
-
accept
public abstract <T> T accept(ExpressionVisitor<T> visitor, java.lang.Object... params) throws SemanticException
Accepts anExpressionVisitor, visiting this expression recursively.- Type Parameters:
T- the type of value produced by the visiting callbacks- Parameters:
visitor- the visitorparams- additional optional parameters to pass to each visiting callback- Returns:
- the value produced by the visiting operation
- Throws:
SemanticException- if an error occurs during the visiting
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
getCodeLocation
public CodeLocation getCodeLocation()
Yields the code location of the statement that has generated this symbolic expression. The code location is not used for the equality between two symbolic expressions.- Returns:
- the code location of the statement that has generated this symbolic expression
-
toString
public abstract java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-