refactor(plan): Phase 286C-4 Step 1 - plan_helpers module

Create helper functions to support plan_rewrites() extraction:
- build_local_block_map(): Build block ID mapping for a function
- sync_spans(): Synchronize instruction spans after rewriting

These pure functions will be used by both the current monolithic
merge_and_rewrite() and the new plan_rewrites() function.

Progress: Step 1/4 (helpers) complete

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2025-12-25 03:53:42 +09:00
parent 875c5e02fd
commit a40ee8dda5
6 changed files with 137 additions and 6 deletions

View File

@ -17,7 +17,21 @@ logic := compare (('&&' | '||') compare)*
compare := sum (( '==' | '!=' | '<' | '>' | '<=' | '>=' ) sum)?
sum := term (('+' | '-') term)*
term := unary (('*' | '/') unary)*
unary := ('-' | '!' | 'not' | '~' | 'weak') unary | factor
unary := ( '-' | '!' | 'not' | '~' ) unary
| weak_unary
| factor
; Phase 285W-Syntax-0.1: `weak(<expr>)` is invalid. The operand must not be a grouped
; expression starting with `(`. (Write `weak x`, not `weak(x)`.)
weak_unary := 'weak' unary_no_group
unary_no_group := ( '-' | '!' | 'not' | '~' ) unary_no_group
| INT
| STRING
| IDENT call_tail*
| 'new' IDENT '(' args? ')'
| '[' args? ']' ; Array literal (Stage1 sugar, gated)
| '{' map_entries? '}' ; Map literal (Stage2 sugar, gated)
| match_expr ; Pattern matching (replaces legacy peek)
factor := INT
| STRING