Interface ISemanticTreeBuilder
-
- All Known Implementing Classes:
SemanticsR7
public interface ISemanticTreeBuilder
This interface is implemented by the semantic implementations of the various parsers.- Since:
- 6.3
- Author:
- F. van der Meer
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ISemanticNode
accept(IParseNode parseNode)
This method should be used to convert a parse node to a semantic node.ITypeEnvironment
getTypeEnvironment()
This method returns the current type environment.boolean
isAssignable(Type fromType, Type targetType)
This method returns a boolean indicating if the first type is assignable to the second type.IFunction
matchFunction(Identifier functionId, ISemanticNode... arguments)
This method may be used to acquire a function implementation.
-
-
-
Method Detail
-
getTypeEnvironment
ITypeEnvironment getTypeEnvironment()
This method returns the current type environment.- Returns:
- the current type environment.
-
isAssignable
boolean isAssignable(Type fromType, Type targetType)
This method returns a boolean indicating if the first type is assignable to the second type.- Parameters:
fromType
- The current type that needs to be "converted" to the target type.targetType
- The type to which the from type will be assigned.- Returns:
- a boolean indicating if the first type is assignable to the second type.
-
accept
ISemanticNode accept(IParseNode parseNode)
This method should be used to convert a parse node to a semantic node.- Parameters:
parseNode
- The parse node that should be converted.- Returns:
- Semantic node for the parse node.
-
matchFunction
IFunction matchFunction(Identifier functionId, ISemanticNode... arguments)
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.- Parameters:
functionId
- The name of the function.arguments
- The arguments that will be passed to the function.- Returns:
- Function matching the name and parameters.
- Throws:
SemanticException
- This exception is thrown when no suitable function could be found.
-
-