symbols.l0

symbols.l0

Module: symbols

Source: compiler/stage2_l0/src/symbols.l0 Language: Dea/L0

Imports / Includes

  • types
  • ast

Symbols

Enum SymbolKind

1
SymbolKind

Defines the SymbolKind enumeration.

Variants:

  • SYM_FUNC
  • SYM_STRUCT
  • SYM_ENUM
  • SYM_ENUM_VARIANT
  • SYM_TYPE_ALIAS
  • SYM_LET

Function symbol_create

1
func symbol_create(name: string, kind: SymbolKind, module_name: string, owner_name: string, decl_ptr: void*, span: Span) -> Symbol*

Create a new symbol with the given properties.

Parameters:

  • name: Name of the symbol.
  • kind: Kind of the symbol.
  • module_name: Name of the module where the symbol is defined.
  • owner_name: Name of the owner (e.g., function or struct) of the symbol.
  • decl_ptr: Pointer to the AST node where the symbol is declared.
  • span: Source code span for error reporting.

Returns: A new Symbol instance with cloned string fields and null resolved type.

Function symbol_set_type_clone

1
func symbol_set_type_clone(self: Symbol*, resolved_type: Type*)

Replace a symbol’s resolved type with a cloned copy.

Parameters:

  • self: Symbol to update.
  • resolved_type: Resolved type to clone into the symbol.

Function symbol_kind_name

1
func symbol_kind_name(kind: SymbolKind) -> string

Return the printable name for a symbol kind.

Parameters:

Returns: Uppercase display name for kind.

Function symbol_free

1
func symbol_free(self: Symbol*)

Free a symbol and any owned resolved type.

Parameters:

Struct Symbol

Represents the Symbol structure.

Symbol Field name

1
name: string

Symbol Field kind

1
kind: SymbolKind

Symbol Field module_name

1
module_name: string

Symbol Field owner_name

1
owner_name: string

Symbol Field decl_ptr

1
decl_ptr: void*

Symbol Field span

1
span: Span

Symbol Field resolved_type

1
resolved_type: Type*?