Module ast
Source - expr
- statements
- Modules that contain definitions and code for statements and expressions in the AST.
- AccessExpr
- Represents an access expression in the AST.
It includes accessing a field or indexing into a collection.
- Assign
- Represents an assignment expression in the AST.
An assignment binds a value to a variable.
- Ast
- Represents the Abstract Syntax Tree (AST) for the language.
- BinOperator
- Represents a binary operator in the AST.
- Binary
- Represents a binary expression in the AST.
A binary expression consists of two operands and an operator (e.g.,
a + b). - Block
- Represents a block of statements enclosed in braces in the AST.
- CallExpr
- Represents a function call in the AST.
It consists of a function name (callee) and a list of arguments.
- Const
- ElseBlock
- Represents an
else or else if block in the AST. - Fn
- Represents a function declaration in the AST.
- FnParam
- Represents a function parameter in the AST.
- FunctionType
- Represents a function type annotation in the AST.
- If
- Represents an
if statement in the AST. - Let
- Represents a variable declaration (
let statement) in the AST. - Literal
- Represents a literal expression in the AST.
It consists of a token and a specific literal value (e.g., integer, string).
- Loop
- ObjectExpr
- Represents an object expression in the AST.
- Parenthesized
- Represents a parenthesized expression in the AST.
Parenthesized expressions are used to override operator precedence.
- Return
- Represents a
return statement in the AST. - Spread
- Spread operator for variadic arguments.
- Struct
- StructConstructor
- Represents a struct constructor expression in the AST.
- StructField
- StructImpl
- ThenElse
- Represents a then-else expression in the AST.
- Throw
- Represents a
throw statement in the AST. - TraitDef
- TraitImpl
- Try
- Represents a
try statement in the AST. - TypeAnnotation
- Represents a type annotation in the AST.
- UnOperator
- Represents a unary operator in the AST.
- Unary
- Represents a unary expression in the AST.
Unary expressions operate on a single operand (e.g.,
-a). - Use
- Represents a
use statement for importing modules or items in the AST. - Variable
- Represents a variable in the AST.
A variable refers to a named entity in the program.
- VecExpr
- Represents a collection of expressions as a vector.
Used to handle lists of expressions, such as arrays or argument lists.
- While
- AccessKind
- Enum representing the kind of access in an access expression.
- AssignOperator
- BinOpAssociativity
- Enum representing the associativity of a binary operator.
- BinOpKind
- Enum representing the various binary operators in the language.
Binary operators are used in binary expressions (e.g.,
a + b). - Expr
- Enum representing an expression in the AST.
Expressions include literals, binary operations, unary operations, and more.
- LiteralType
- Enum that defines the possible literal types in the language.
Literals are constant values such as numbers, strings, and booleans.
- Stmt
- Represents a statement in the AST.
- UnOpKind
- Enum representing unary operator kinds (e.g.,
-, ~).
- GetSpan
- A trait to get the source code position (span) of a node in the AST.