Asama 3.2 — Implement SymbolCollector that populates SymbolTable from AST #47

Open
opened 2026-05-26 19:52:15 +03:00 by saqut · 0 comments
Owner

Goal: Walk the AST and populate the SymbolTable with all definitions and references.

Files to create/modify:

  • src/symbol/symbol_collector.hpp (new)
  • Replace/refactor the simple collectSymbolsRecursive in src/json.hpp

Requirements:

  • SymbolCollector class with collect(ASTNode* root, SymbolTable* table).
  • Walks all AST node types (Program, FunctionDecl, VariableDecl, Block, etc.).
  • Calls table->define() for declarations.
  • Calls table->addReference() for identifier usages.
  • Handles all 19 AST node types.

Success criteria:

  • After parsing source.sqt, SymbolTable contains all functions and variables.
  • saqut symbols source.sqt shows enriched data.
**Goal:** Walk the AST and populate the SymbolTable with all definitions and references. **Files to create/modify:** - src/symbol/symbol_collector.hpp (new) - Replace/refactor the simple collectSymbolsRecursive in src/json.hpp **Requirements:** - SymbolCollector class with collect(ASTNode* root, SymbolTable* table). - Walks all AST node types (Program, FunctionDecl, VariableDecl, Block, etc.). - Calls table->define() for declarations. - Calls table->addReference() for identifier usages. - Handles all 19 AST node types. **Success criteria:** - After parsing source.sqt, SymbolTable contains all functions and variables. - saqut symbols source.sqt shows enriched data.
Sign in to join this conversation.
No Label
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: saqut/saqut-compiler#47
No description provided.