java.lang.Object
com.aquima.interactions.expressions.r7.semantics.SemanticsR7
All Implemented Interfaces:
ISemanticTreeBuilder

public class SemanticsR7 extends Object implements ISemanticTreeBuilder
This class is used to transform a release 6 expression parse nodes to semantic nodes.
Since:
6.4
Author:
F. van der Meer, O. Kerpershoek
  • Constructor Details

    • SemanticsR7

      public SemanticsR7(ITypeEnvironment environment, boolean v7OperationTyping)
      Constructs the semantic class with the type environment that should be used.
      Parameters:
      environment - The type environment that should be used.
      v7OperationTyping - Boolean indicating if the version 7 (strict) typing should be used.
  • Method Details

    • accept

      public ISemanticNode accept(IParseNode node)
      Description copied from interface: ISemanticTreeBuilder
      This method should be used to convert a parse node to a semantic node.
      Specified by:
      accept in interface ISemanticTreeBuilder
      Parameters:
      node - The parse node that should be converted.
      Returns:
      Semantic node for the parse node.
    • isAssignable

      public boolean isAssignable(Type type, Type target)
      Description copied from interface: ISemanticTreeBuilder
      This method returns a boolean indicating if the first type is assignable to the second type.
      Specified by:
      isAssignable in interface ISemanticTreeBuilder
      Parameters:
      type - The current type that needs to be "converted" to the target type.
      target - The type to which the from type will be assigned.
      Returns:
      a boolean indicating if the first type is assignable to the second type.
    • getTypeEnvironment

      public ITypeEnvironment getTypeEnvironment()
      Description copied from interface: ISemanticTreeBuilder
      This method returns the current type environment.
      Specified by:
      getTypeEnvironment in interface ISemanticTreeBuilder
      Returns:
      the current type environment.
    • matchFunction

      public IFunction matchFunction(Identifier functionId, ISemanticNode... arguments)
      Description copied from interface: ISemanticTreeBuilder
      This method may be used to acquire a function implementation. The implementation will try to find a function that matches the name and arguments as closely as possible.
      Specified by:
      matchFunction in interface ISemanticTreeBuilder
      Parameters:
      functionId - The name of the function.
      arguments - The arguments that will be passed to the function.
      Returns:
      Function matching the name and parameters.
    • convertNode

      public ISemanticNode convertNode(ISemanticNode expr, Type requestedType)
      This method may be used to convert a semantic node to the requested type.
      Parameters:
      expr - The semantic node whose type should be changed.
      requestedType - The requested type of the node.
      Returns:
      Semantic node of the correct type.