Node
Last updated
Last updated
Function and structure nodes are a direct representation of Lexica source code. They are part of an abstract syntax tree. This module deals with the processing and verification of parsed nodes.
The processed function type of the requested function.
The parsed function type of the requested function.
The function node of the requested function.
The directly parsed function of the requested function.
In Lexica, every logical unit of code is an expression. Every expression returns a particular value and type. Code that appears to not have any value such as bindings or mutations have the unit type.
Expressions are stored in a function context object and are accessed through an ExpressionKey
. Nested expressions are denoted with an ExpressionKey
rather than the nested expression itself. This indirection makes it cheaper to copy and process expressions.
As the inference query depends on a fully processed function node, type information is not available at this stage of processing a function.
Variables are implicitly shadowed when a new binding is made of an already bound variable name. The shadow module assigns generations to variables within the node to distinguish between shadowed variables with the same identifier.
Parameter variables always have a generation of zero as there can never be duplicate parameter identifiers in a function signature.
When ascriptions and function calls are parsed, the actual path to the types and functions are unknown. The resolution module uses the context of a module and its inclusions to resolve the full path of a structure or function.
Structure
Description
Function Type
Represents the signature of a function including any parameters
Node Function
Represents a parsed function
Function Context
Contains the expressions of a function
Structure
Represents a structure and its fields