compiler/stage2_l0/src/ast.l0
Module ast
Overview Symbols grouped by source file: compiler/stage2_l0/src/ast.l0
Module: ast
Source: compiler/stage2_l0/src/ast.l0 Language: Dea/L0
Imports / Includes
std.vectorstd.stringstd.assert
Symbols
- TopLevelDeclKind
- PatternKind
- ExprKind
- StmtKind
- ExprId
- StmtId
- PatternId
- invalid_expr_id
- invalid_stmt_id
- invalid_pattern_id
- ptr_vec_create
- ptr_vec_push
- ptr_vec_get
- id_vec_create
- id_vec_push
- id_vec_get
- span_here
- pattern_node_create
- pattern_arena_create
- pattern_arena_add
- pattern_arena_get
- sv_free_opt
- pattern_node_free
- pattern_arena_free
- expr_node_create
- expr_arena_create
- expr_arena_add
- expr_arena_get
- stmt_node_create
- stmt_arena_create
- stmt_arena_add
- stmt_arena_get
- type_ref_free
- param_free
- field_decl_free
- enum_variant_free
- func_decl_free
- struct_decl_free
- enum_decl_free
- type_alias_decl_free
- let_decl_free
- top_level_decl_free
- module_free
- id_vec_free
- import_vec_free
- top_level_decl_vec_free
- param_vec_free
- field_decl_vec_free
- enum_variant_vec_free
- match_arm_vec_free
- case_arm_vec_free
- with_item_vec_free
- expr_node_free
- stmt_node_free
- expr_arena_free
- stmt_arena_free
- Span
- TypeRef
- Import
- Param
- FieldDecl
- EnumVariant
- FuncDecl
- StructDecl
- EnumDecl
- TypeAliasDecl
- LetDecl
- TopLevelDecl
- Module
- PatternNode
- PatternArena
- ExprNode
- ExprArena
- MatchArm
- CaseArm
- CaseElse
- WithItem
- StmtNode
- StmtArena
Enum TopLevelDeclKind
TopLevelDeclKind
Defines the TopLevelDeclKind enumeration.
Variants:
TD_FUNCTD_STRUCTTD_ENUMTD_TYPE_ALIASTD_LET
Enum PatternKind
PatternKind
Defines the PatternKind enumeration.
Variants:
PT_WILDCARDPT_VARIANT
Enum ExprKind
ExprKind
Defines the ExprKind enumeration.
Variants:
EX_INTEX_BYTEEX_STRINGEX_BOOLEX_NULLEX_VAR_REFEX_NEWEX_UNARYEX_BINARYEX_CALLEX_INDEXEX_FIELDEX_PARENEX_CASTEX_TRYEX_TYPE
Enum StmtKind
StmtKind
Defines the StmtKind enumeration.
Variants:
ST_BLOCKST_LETST_ASSIGNST_EXPRST_IFST_WHILEST_FORST_RETURNST_DROPST_MATCHST_CASEST_BREAKST_CONTINUEST_WITH
Type Alias ExprId
type ExprId = int
Type Alias StmtId
type StmtId = int
Type Alias PatternId
type PatternId = int
Function invalid_expr_id
func invalid_expr_id() -> ExprId
Returns an invalid ID for a expr to indicate absence.
Returns: The sentinel value indicating an invalid expression ID (-1).
Function invalid_stmt_id
func invalid_stmt_id() -> StmtId
Returns an invalid ID for a stmt to indicate absence.
Returns: The sentinel value indicating an invalid statement ID (-1).
Function invalid_pattern_id
func invalid_pattern_id() -> PatternId
Returns an invalid ID for a pattern to indicate absence.
Returns: The sentinel value indicating an invalid pattern ID (-1).
Function ptr_vec_create
func ptr_vec_create(initial_capacity: int) -> VectorBase*
Create a vector of pointer slots.
Parameters:
initial_capacity: Initial vector capacity.
Returns: New pointer vector.
Function ptr_vec_push
func ptr_vec_push(self: VectorBase*, ptr: void*)
Append a pointer value to a pointer vector.
Parameters:
self: Pointer vector to extend.ptr: Pointer value to append.
Function ptr_vec_get
func ptr_vec_get(self: VectorBase*, index: int) -> void*
Return a pointer value from a pointer vector.
Parameters:
self: Pointer vector to inspect.index: Zero-based element index.
Returns: Pointer value at index.
Function id_vec_create
func id_vec_create(initial_capacity: int) -> VectorBase*
Create a vector of integer ids.
Parameters:
initial_capacity: Initial vector capacity.
Returns: New id vector.
Function id_vec_push
func id_vec_push(self: VectorBase*, id: int)
Append an id to an id vector.
Parameters:
self: Id vector to extend.id: Id value to append.
Function id_vec_get
func id_vec_get(self: VectorBase*, index: int) -> int
Return an id from an id vector.
Parameters:
self: Id vector to inspect.index: Zero-based element index.
Returns: Id value at index.
Function span_here
func span_here(line: int, column: int) -> Span
Build a zero-width span at a source location.
Parameters:
line: One-based source line.column: One-based source column.
Returns: Span whose start and end are the same location.
Function pattern_node_create
func pattern_node_create(kind: PatternKind, span: Span) -> PatternNode*
Create a pattern node.
Parameters:
kind: Pattern kind.span: Source span for the node.
Returns: New pattern node.
Function pattern_arena_create
func pattern_arena_create(initial_capacity: int) -> PatternArena*
Create a pattern arena.
Parameters:
initial_capacity: Initial arena capacity.
Returns: New pattern arena.
Function pattern_arena_add
func pattern_arena_add(self: PatternArena*, node: PatternNode*) -> PatternId
Add a pattern node to the arena.
Parameters:
self: Pattern arena to extend.node: Pattern node to store.
Returns: Pattern id assigned to the stored node.
Function pattern_arena_get
func pattern_arena_get(self: PatternArena*, id: PatternId) -> PatternNode*
Return a pattern node from the arena.
Parameters:
self: Pattern arena to inspect.id: Pattern id to look up.
Returns: Pattern node for id.
Function sv_free_opt
func sv_free_opt(v: StringVector*?)
Free an optional string vector.
Parameters:
v: Optional vector to free.
Function pattern_node_free
func pattern_node_free(node: PatternNode*)
Free a pattern node and any owned vectors.
Parameters:
node: Pattern node to free.
Function pattern_arena_free
func pattern_arena_free(self: PatternArena*)
Free a pattern arena and every stored node.
Parameters:
self: Pattern arena to free.
Function expr_node_create
func expr_node_create(kind: ExprKind, span: Span) -> ExprNode*
Create an expression node.
Parameters:
kind: Expression kind.span: Source span for the node.
Returns: New expression node.
Function expr_arena_create
func expr_arena_create(initial_capacity: int) -> ExprArena*
Create an expression arena.
Parameters:
initial_capacity: Initial arena capacity.
Returns: New expression arena.
Function expr_arena_add
func expr_arena_add(self: ExprArena*, node: ExprNode*) -> ExprId
Add an expression node to the arena.
Parameters:
self: Expression arena to extend.node: Expression node to store.
Returns: Expression id assigned to the stored node.
Function expr_arena_get
func expr_arena_get(self: ExprArena*, id: ExprId) -> ExprNode*
Return an expression node from the arena.
Parameters:
self: Expression arena to inspect.id: Expression id to look up.
Returns: Expression node for id.
Function stmt_node_create
func stmt_node_create(kind: StmtKind, span: Span) -> StmtNode*
Create a statement node.
Parameters:
kind: Statement kind.span: Source span for the node.
Returns: New statement node.
Function stmt_arena_create
func stmt_arena_create(initial_capacity: int) -> StmtArena*
Create a statement arena.
Parameters:
initial_capacity: Initial arena capacity.
Returns: New statement arena.
Function stmt_arena_add
func stmt_arena_add(self: StmtArena*, node: StmtNode*) -> StmtId
Add a statement node to the arena.
Parameters:
self: Statement arena to extend.node: Statement node to store.
Returns: Statement id assigned to the stored node.
Function stmt_arena_get
func stmt_arena_get(self: StmtArena*, id: StmtId) -> StmtNode*
Return a statement node from the arena.
Parameters:
self: Statement arena to inspect.id: Statement id to look up.
Returns: Statement node for id.
Function type_ref_free
func type_ref_free(self: TypeRef*?)
Free an optional type reference.
Parameters:
self: Optional type reference to free.
Function param_free
func param_free(self: Param*)
Free a function parameter node.
Parameters:
self: Parameter to free.
Function field_decl_free
func field_decl_free(self: FieldDecl*)
Free a field declaration node.
Parameters:
self: Field declaration to free.
Function enum_variant_free
func enum_variant_free(self: EnumVariant*)
Free an enum variant declaration.
Parameters:
self: Enum variant to free.
Function func_decl_free
func func_decl_free(self: FuncDecl*)
Free a function declaration.
Parameters:
self: Function declaration to free.
Function struct_decl_free
func struct_decl_free(self: StructDecl*)
Free a struct declaration.
Parameters:
self: Struct declaration to free.
Function enum_decl_free
func enum_decl_free(self: EnumDecl*)
Free an enum declaration.
Parameters:
self: Enum declaration to free.
Function type_alias_decl_free
func type_alias_decl_free(self: TypeAliasDecl*)
Free a type-alias declaration.
Parameters:
self: Type-alias declaration to free.
Function let_decl_free
func let_decl_free(self: LetDecl*)
Free a top-level let declaration.
Parameters:
self: Let declaration to free.
Function top_level_decl_free
func top_level_decl_free(self: TopLevelDecl*)
Free a top-level declaration wrapper and its payload.
Parameters:
self: Top-level declaration to free.
Function module_free
func module_free(self: Module*)
Free a parsed module and its owned declarations.
Parameters:
self: Module to free.
Function id_vec_free
func id_vec_free(v: VectorBase*?)
Free an optional id vector.
Parameters:
v: Optional vector to free.
Function import_vec_free
func import_vec_free(v: VectorBase*?)
Free an optional import vector.
Parameters:
v: Optional import vector to free.
Function top_level_decl_vec_free
func top_level_decl_vec_free(v: VectorBase*?)
Free an optional top-level declaration vector.
Parameters:
v: Optional declaration vector to free.
Function param_vec_free
func param_vec_free(v: VectorBase*?)
Free an optional parameter vector.
Parameters:
v: Optional parameter vector to free.
Function field_decl_vec_free
func field_decl_vec_free(v: VectorBase*?)
Free an optional field-declaration vector.
Parameters:
v: Optional field-declaration vector to free.
Function enum_variant_vec_free
func enum_variant_vec_free(v: VectorBase*?)
Free an optional enum-variant vector.
Parameters:
v: Optional enum-variant vector to free.
Function match_arm_vec_free
func match_arm_vec_free(v: VectorBase*?)
Free an optional match-arm vector.
Parameters:
v: Optional match-arm vector to free.
Function case_arm_vec_free
func case_arm_vec_free(v: VectorBase*?)
Free an optional case-arm vector.
Parameters:
v: Optional case-arm vector to free.
Function with_item_vec_free
func with_item_vec_free(v: VectorBase*?)
Free an optional with -item vector.
Parameters:
v: Optionalwith-item vector to free.
Function expr_node_free
func expr_node_free(self: ExprNode*)
Free an expression node and its owned payload.
Parameters:
self: Expression node to free.
Function stmt_node_free
func stmt_node_free(self: StmtNode*)
Free a statement node and its owned payload.
Parameters:
self: Statement node to free.
Function expr_arena_free
func expr_arena_free(self: ExprArena*)
Free an expression arena and every stored node.
Parameters:
self: Expression arena to free.
Function stmt_arena_free
func stmt_arena_free(self: StmtArena*)
Free a statement arena and every stored node.
Parameters:
self: Statement arena to free.
Struct Span
Represents the Span structure.
Span Field start_line
start_line: int
Span Field start_column
start_column: int
Span Field end_line
end_line: int
Span Field end_column
end_column: int
Struct TypeRef
Represents the TypeRef structure.
TypeRef Field name
name: string
TypeRef Field pointer_depth
pointer_depth: int
TypeRef Field is_nullable
is_nullable: bool
TypeRef Field module_path
module_path: StringVector*?
TypeRef Field name_qualifier
name_qualifier: StringVector*?
TypeRef Field span
span: Span
Struct Import
Represents the Import structure.
Import Field name
name: string
Import Field span
span: Span
Struct Param
Represents the Param structure.
Param Field name
name: string
Param Field type_ref
type_ref: TypeRef*
Struct FieldDecl
Represents the FieldDecl structure.
FieldDecl Field name
name: string
FieldDecl Field type_ref
type_ref: TypeRef*
Struct EnumVariant
Represents the EnumVariant structure.
EnumVariant Field name
name: string
EnumVariant Field fields
fields: VectorBase*
Struct FuncDecl
Represents the FuncDecl structure.
FuncDecl Field name
name: string
FuncDecl Field params
params: VectorBase*
FuncDecl Field return_type
return_type: TypeRef*
FuncDecl Field body
body: StmtId
FuncDecl Field is_extern
is_extern: bool
FuncDecl Field span
span: Span
Struct StructDecl
Represents the StructDecl structure.
StructDecl Field name
name: string
StructDecl Field fields
fields: VectorBase*
StructDecl Field span
span: Span
Struct EnumDecl
Represents the EnumDecl structure.
EnumDecl Field name
name: string
EnumDecl Field variants
variants: VectorBase*
EnumDecl Field span
span: Span
Struct TypeAliasDecl
Represents the TypeAliasDecl structure.
TypeAliasDecl Field name
name: string
TypeAliasDecl Field target
target: TypeRef*
TypeAliasDecl Field span
span: Span
Struct LetDecl
Represents the LetDecl structure.
LetDecl Field name
name: string
LetDecl Field type_ref
type_ref: TypeRef*?
LetDecl Field value
value: ExprId
LetDecl Field span
span: Span
Struct TopLevelDecl
Represents the TopLevelDecl structure.
TopLevelDecl Field kind
kind: TopLevelDeclKind
TopLevelDecl Field data
data: void*
Struct Module
Represents the Module structure.
Module Field name
name: string
Module Field imports
imports: VectorBase*
Module Field decls
decls: VectorBase*
Module Field span
span: Span
Module Field filename
filename: string
Struct PatternNode
Represents the PatternNode structure.
PatternNode Field kind
kind: PatternKind
PatternNode Field span
span: Span
PatternNode Field name
name: string
PatternNode Field vars
vars: StringVector*?
PatternNode Field module_path
module_path: StringVector*?
PatternNode Field name_qualifier
name_qualifier: StringVector*?
Struct PatternArena
Represents the PatternArena structure.
PatternArena Field nodes
nodes: VectorBase*
Struct ExprNode
Represents the ExprNode structure.
ExprNode Field kind
kind: ExprKind
ExprNode Field span
span: Span
ExprNode Field int_value
int_value: int
ExprNode Field bool_value
bool_value: bool
ExprNode Field text_value
text_value: string
ExprNode Field expr_a
expr_a: ExprId
ExprNode Field expr_b
expr_b: ExprId
ExprNode Field expr_c
expr_c: ExprId
ExprNode Field ids
ids: VectorBase*?
ExprNode Field type_ref
type_ref: TypeRef*?
ExprNode Field module_path
module_path: StringVector*?
ExprNode Field name_qualifier
name_qualifier: StringVector*?
Struct ExprArena
Represents the ExprArena structure.
ExprArena Field nodes
nodes: VectorBase*
Struct MatchArm
Represents the MatchArm structure.
MatchArm Field pattern
pattern: PatternId
MatchArm Field body
body: StmtId
MatchArm Field span
span: Span
Struct CaseArm
Represents the CaseArm structure.
CaseArm Field literal
literal: ExprId
CaseArm Field body
body: StmtId
CaseArm Field span
span: Span
Struct CaseElse
Represents the CaseElse structure.
CaseElse Field body
body: StmtId
CaseElse Field span
span: Span
Struct WithItem
Represents the WithItem structure.
WithItem Field init
init: StmtId
WithItem Field cleanup_stmt
cleanup_stmt: StmtId
WithItem Field has_cleanup
has_cleanup: bool
WithItem Field span
span: Span
Struct StmtNode
Represents the StmtNode structure.
StmtNode Field kind
kind: StmtKind
StmtNode Field span
span: Span
StmtNode Field name
name: string
StmtNode Field type_ref
type_ref: TypeRef*?
StmtNode Field expr_a
expr_a: ExprId
StmtNode Field expr_b
expr_b: ExprId
StmtNode Field stmt_a
stmt_a: StmtId
StmtNode Field stmt_b
stmt_b: StmtId
StmtNode Field stmt_c
stmt_c: StmtId
StmtNode Field ids
ids: VectorBase*?
StmtNode Field match_arms
match_arms: VectorBase*?
StmtNode Field case_arms
case_arms: VectorBase*?
StmtNode Field case_else
case_else: CaseElse*?
StmtNode Field with_items
with_items: VectorBase*?
Struct StmtArena
Represents the StmtArena structure.
StmtArena Field nodes
nodes: VectorBase*