Luma 0.1.0
A low-level compiled alternative to C, C++, and more!
Loading...
Searching...
No Matches
Functions
lookup.c File Reference
#include <stddef.h>
#include <stdio.h>
#include "type.h"
Include dependency graph for lookup.c:

Functions

bool typecheck_statement (AstNode *stmt, Scope *scope, ArenaAllocator *arena)
 
AstNodetypecheck_expression (AstNode *expr, Scope *scope, ArenaAllocator *arena)
 
bool typecheck_program_multipass (AstNode *program, Scope *global_scope, ArenaAllocator *arena)
 Three-pass typechecking for modules to handle forward references.
 

Function Documentation

◆ typecheck_expression()

AstNode * typecheck_expression ( AstNode expr,
Scope scope,
ArenaAllocator arena 
)

◆ typecheck_program_multipass()

bool typecheck_program_multipass ( AstNode program,
Scope global_scope,
ArenaAllocator arena 
)

Three-pass typechecking for modules to handle forward references.

This allows modules to be declared and used in any order by:

  • Pass 1: Registering all module scopes (creates namespaces)
  • Pass 2: Processing all @use statements (resolves imports)
  • Pass 3: Typechecking module bodies (validates code)
Parameters
programAST_PROGRAM node containing all modules
global_scopeGlobal scope to register modules in
arenaArena allocator for memory management
Returns
true if all passes succeed, false on any error

◆ typecheck_statement()

bool typecheck_statement ( AstNode stmt,
Scope scope,
ArenaAllocator arena 
)