Summary
When a block has semantic errors (like variable redefinition), the evaluator aborts before interpretation. Statements that passed semantic checking never run, so runtime errors (like 1 / 0) and successful computations are invisible.
Example
a = 1 / 0 ← no diagnostic shown (interpretation never ran)
a = 2 ← ✗ cannot reassign 'a'
c = 3 ← no value shown
c = 5 ← ✗ cannot reassign 'c'
Expected: a = 1 / 0 should show ✗ division by zero and c = 3 should show = 3.
Current Behavior
The semantic checker collects all error diagnostics (fixed in #112). But the evaluator returns immediately after semantic errors without interpreting any statements. Statements that are semantically valid (like a = 1 / 0 and c = 3) never execute.
Proposed Approach
After collecting semantic diagnostics, still run interpretation for statements that passed semantic checking. Skip statements that have semantic errors. This would require:
- Marking which AST nodes have semantic errors (by line number from diagnostics)
- Running the interpreter on non-errored nodes only
- Collecting both semantic and runtime diagnostics on the same block
Context
Discovered during #73 / #112 error recovery work. The evaluator now recovers from runtime errors (statement-level and block-level), but semantic errors still abort the block entirely.
Summary
When a block has semantic errors (like variable redefinition), the evaluator aborts before interpretation. Statements that passed semantic checking never run, so runtime errors (like
1 / 0) and successful computations are invisible.Example
Expected:
a = 1 / 0should show✗ division by zeroandc = 3should show= 3.Current Behavior
The semantic checker collects all error diagnostics (fixed in #112). But the evaluator returns immediately after semantic errors without interpreting any statements. Statements that are semantically valid (like
a = 1 / 0andc = 3) never execute.Proposed Approach
After collecting semantic diagnostics, still run interpretation for statements that passed semantic checking. Skip statements that have semantic errors. This would require:
Context
Discovered during #73 / #112 error recovery work. The evaluator now recovers from runtime errors (statement-level and block-level), but semantic errors still abort the block entirely.