-
Notifications
You must be signed in to change notification settings - Fork 4
No Symbol Table for Variable Tracking #5
Copy link
Copy link
Open
Description
Description
The compiler currently has no symbol table. As a result, variables declared using let are never stored, and identifiers cannot be resolved during later stages of compilation.
Although the parser builds AST_VAR_DECL and AST_VAR nodes, there is no data structure that tracks variable names and their associated values or IR representations.
Example Input
let x = 1;
let y = x + 2;
Current Behavior
- Variable declarations (
let x = ...) do not storexanywhere - Identifier usage (
x) cannot be resolved - IR generation ignores variable scope and lifetime
- LLVM output discards computed values
- No error is reported for undefined variables
Expected Behavior
- A symbol table should map variable names to their values or IR references
- Variable declarations should insert entries into the symbol table
- Identifier usage should look up variables in the symbol table
- Using an undefined variable should produce a clear error
Suggested Direction
- Introduce a symbol table data structure (e.g. hash map or scoped table)
- Integrate symbol table into parsing or IR generation
- Handle
AST_VAR_DECLandAST_VARusing the symbol table - Prepare for future scope support (blocks, functions)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels