• Roman Alifanov's avatar
    Rewrite compiler: IR-based architecture replacing bootstrap · 31bfe20c
    Roman Alifanov authored
    Replace the bootstrap mixin-based compiler with a new IR-based pipeline:
    Source → Lexer → Parser → Resolver → TypeChecker → IR Builder → Optimizer → Backend
    
    New architecture (compiler/):
    - semantics/: scope resolution, type system, type checker
    - ir/: intermediate representation with stable node IDs
    - optimizer/: DCE via call graph BFS, CSE, constant folding
    - backend/bash/: bash code generation from IR
    - backend/awk/: AWK code generation sharing same IR
    - symbols/: symbol table with LSP-ready serialization
    
    Key improvements:
    - Explicit shell command detection (IRCall.is_shell_cmd)
    - Namespace prefixing only in bash backend, not in resolver
    - DCE reduced from 580-line fixed-point to ~40-line BFS
    - CSE uses stable node_id instead of Python id()
    - Shell commands in assignments use || true for set -e safety
    - No local keyword in global scope (when/foreach)
    - Coproc uses exec to prevent orphan child processes
    
    All 400 tests pass. Verified with real-world unified-theme-switcher service.
    31bfe20c