Package it.unive.lisa.analysis.heap
Class BaseHeapDomain.Rewriter
- java.lang.Object
-
- it.unive.lisa.analysis.heap.BaseHeapDomain.Rewriter
-
- All Implemented Interfaces:
ExpressionVisitor<ExpressionSet>
- Enclosing interface:
- BaseHeapDomain<H extends BaseHeapDomain<H>>
public abstract static class BaseHeapDomain.Rewriter extends java.lang.Object implements ExpressionVisitor<ExpressionSet>
AnExpressionVisitor
that rewritesSymbolicExpression
s toValueExpression
s. The visiting ofHeapExpression
s is left unimplemented for concrete instances to provide their logic.
-
-
Constructor Summary
Constructors Constructor Description Rewriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected SymbolicExpression
removeTypingExpressions(SymbolicExpression e)
Extracts the inner expressions from casts/conversions.ExpressionSet
visit(HeapExpression expression, ExpressionSet[] subExpressions, java.lang.Object... params)
Visits a genericHeapExpression
.ExpressionSet
visit(BinaryExpression expression, ExpressionSet left, ExpressionSet right, java.lang.Object... params)
Visits aBinaryExpression
.ExpressionSet
visit(Constant expression, java.lang.Object... params)
Visits aConstant
.ExpressionSet
visit(Identifier expression, java.lang.Object... params)
Visits anIdentifier
.ExpressionSet
visit(PushAny expression, java.lang.Object... params)
Visits aPushAny
.ExpressionSet
visit(PushInv expression, java.lang.Object... params)
Visits aPushInv
.ExpressionSet
visit(Skip expression, java.lang.Object... params)
Visits aSkip
.ExpressionSet
visit(TernaryExpression expression, ExpressionSet left, ExpressionSet middle, ExpressionSet right, java.lang.Object... params)
Visits aTernaryExpression
.ExpressionSet
visit(UnaryExpression expression, ExpressionSet arg, java.lang.Object... params)
Visits aUnaryExpression
.ExpressionSet
visit(ValueExpression expression, ExpressionSet[] subExpressions, java.lang.Object... params)
Visits a genericValueExpression
.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface it.unive.lisa.symbolic.ExpressionVisitor
visit, visit, visit, visit
-
-
-
-
Method Detail
-
removeTypingExpressions
protected SymbolicExpression removeTypingExpressions(SymbolicExpression e)
Extracts the inner expressions from casts/conversions. Ife
is of the form(type) e1
, this method returnsremoveTypingExpressions(e1)
. Otherwise,e
is returned with no modifications.- Parameters:
e
- the expression to strip from type operators- Returns:
- the inner expression, if needed
-
visit
public ExpressionSet visit(UnaryExpression expression, ExpressionSet arg, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aUnaryExpression
. This callback is invoked after the inner expressions have been visited, and their produced value is passed as argument.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the expressionarg
- the value produced by visiting the argument of the expressionparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the expression
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(BinaryExpression expression, ExpressionSet left, ExpressionSet right, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aBinaryExpression
. This callback is invoked after the inner expressions have been visited, and their produced value is passed as argument.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the expressionleft
- the value produced by visiting the left-hand side of the expressionright
- the value produced by visiting the right-hand side of the expressionparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the expression
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(TernaryExpression expression, ExpressionSet left, ExpressionSet middle, ExpressionSet right, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aTernaryExpression
. This callback is invoked after the inner expressions have been visited, and their produced value is passed as argument.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the expressionleft
- the value produced by visiting the left-hand side of the expressionmiddle
- the value produced by visiting the middle-hand side of the expressionright
- the value produced by visiting the right-hand side of the expressionparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the expression
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(Skip expression, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aSkip
.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the skipparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the skip
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(PushAny expression, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aPushAny
.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the pushanyparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the pushany
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(PushInv expression, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aPushInv
.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the pushinvparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the pushinv
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(Constant expression, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits aConstant
.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the constantparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the constant
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(Identifier expression, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits anIdentifier
.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the identifierparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the identifier
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(HeapExpression expression, ExpressionSet[] subExpressions, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits a genericHeapExpression
. This callback is invoked after the inner expressions have been visited, and their produced value is passed as argument.
This overload allows visiting frontend-defined expressions. For all standard expressions defined within LiSA, the corresponding overload will be invoked instead.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the expressionsubExpressions
- the values produced by visiting the sub-expressions, if any; if there are no sub-expressions, this parameter can benull
or emptyparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the expression
- Throws:
SemanticException
- if an error occurs during the visit operation
-
visit
public ExpressionSet visit(ValueExpression expression, ExpressionSet[] subExpressions, java.lang.Object... params) throws SemanticException
Description copied from interface:ExpressionVisitor
Visits a genericValueExpression
. This callback is invoked after the inner expressions have been visited, and their produced value is passed as argument.
This overload allows visiting frontend-defined expressions. For all standard expressions defined within LiSA, the corresponding overload will be invoked instead.- Specified by:
visit
in interfaceExpressionVisitor<ExpressionSet>
- Parameters:
expression
- the expressionsubExpressions
- the values produced by visiting the sub-expressions, if any; if there are no sub-expressions, this parameter can benull
or emptyparams
- the additional parameters provided toSymbolicExpression.accept(ExpressionVisitor, Object...)
, if any- Returns:
- the value produced by visiting the expression
- Throws:
SemanticException
- if an error occurs during the visit operation
-
-