Class SymbolicExpression

    • Constructor Detail

      • SymbolicExpression

        protected SymbolicExpression​(ExternalSet<Type> types,
                                     CodeLocation location)
        Builds the symbolic expression.
        Parameters:
        types - the runtime types of this expression
        location - 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 through getTypes().
        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 all Variables to become OutOfScopeIdentifiers 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 an ExpressionVisitor, visiting this expression recursively.
        Type Parameters:
        T - the type of value produced by the visiting callbacks
        Parameters:
        visitor - the visitor
        params - 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:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(java.lang.Object obj)
        Overrides:
        equals in class java.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:
        toString in class java.lang.Object