Here's a comprehensive analysis of where life.occ stands now.
Status
Of the 7 blocking issues (#73–#79), 6 are closed and the features work correctly. #74 (multi-dimensional arrays) is still listed as open, but 2D and 3D array declarations, parameters, and indexing actually do work now. The remaining parse failures are from two distinct bugs:
Remaining Issue 1: Receive into indexed target variables
Lines affected: 57, 225 (and others)
The parser only accepts a simple identifier after ? in channel receive. Indexed targets like flags[0] or state.of.neighbour[d] fail.
-- Works:
link[0][0][0] ? x
-- Fails:
link[0][0][0] ? flags[0] -- indexed target
sense[x][y] ? changed; next.state -- (this works since changed/next.state are plain idents)
Root cause: Both parseReceive() (line 1291) and parseIndexedOperation() (line 789) do p.expectPeek(lexer.IDENT) after ?, which only accepts a bare identifier. The Receive AST node stores Variable string — it can't represent an indexed target. The leftover [0] tokens then get misinterpreted as an array declaration, producing the "expected type after array size" error.
Fix scope: AST (Receive.Variable → support indexed targets), parser (both parseReceive and parseIndexedOperation), codegen (generate indexed receive targets), and the same in ALT case parsing.
Remaining Issue 2: Variant receive with scoped declarations in case bodies
Lines affected: 99–117
When a variant ? CASE body starts with a declaration (e.g., BOOL next.state :) followed by a compound statement, parsing fails.
-- Works:
control ? CASE
evolve
SEQ -- single compound statement, fine
...
-- Fails:
control ? CASE
evolve
BOOL next.state : -- declaration scoping over SEQ
SEQ
...
Root cause: parseVariantReceive() at line 1387 calls p.parseStatement() once per case body. A single statement (even SEQ) is fine, but a scoped declaration (BOOL x : followed by SEQ ...) needs block-level parsing that handles the declaration-scopes-over-process pattern.
Fix scope: Parser only — change the variant case body parsing to use parseBodyStatements() (or similar) instead of a single parseStatement() call, matching how IF/CASE/ALT bodies already work.
Beyond parsing: runtime dependencies
Even after fixing these two parser bugs, life.occ won't run standalone because it depends on external library routines not defined in the file:
- write.string, write.formatted (output library)
- CHAN OF DATA.ITEM, data.int (formatted I/O protocol)
- terminal.keyboard, terminal.screen (system channels)
These would need to be stubbed or provided by transpiling the course module alongside.
Recommendation
Issue #74 can likely be closed (or narrowed) since multi-dimensional arrays work. The two bugs above should be filed as new issues — they're both well-scoped parser fixes that don't require architectural changes.