Class SemanticsR7
java.lang.Object
com.aquima.interactions.expressions.r7.semantics.SemanticsR7
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionSemanticsR7
(ITypeEnvironment environment, boolean v7OperationTyping) Constructs the semantic class with the type environment that should be used. -
Method Summary
Modifier and TypeMethodDescriptionaccept
(IParseNode node) This method should be used to convert a parse node to a semantic node.convertNode
(ISemanticNode expr, Type requestedType) This method may be used to convert a semantic node to the requested type.This method returns the current type environment.boolean
isAssignable
(Type type, Type target) This method returns a boolean indicating if the first type is assignable to the second type.matchFunction
(Identifier functionId, ISemanticNode... arguments) This method may be used to acquire a function implementation.
-
Constructor Details
-
SemanticsR7
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
Description copied from interface:ISemanticTreeBuilder
This method should be used to convert a parse node to a semantic node.- Specified by:
accept
in interfaceISemanticTreeBuilder
- Parameters:
node
- The parse node that should be converted.- Returns:
- Semantic node for the parse node.
-
isAssignable
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 interfaceISemanticTreeBuilder
- 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
Description copied from interface:ISemanticTreeBuilder
This method returns the current type environment.- Specified by:
getTypeEnvironment
in interfaceISemanticTreeBuilder
- Returns:
- the current type environment.
-
matchFunction
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 interfaceISemanticTreeBuilder
- 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
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.
-