• 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
Name
Last commit
Last update
..
__init__.py Loading commit data...
conftest.py Loading commit data...
helpers.py Loading commit data...
test_async.py Loading commit data...
test_autoscan.py Loading commit data...
test_awk.py Loading commit data...
test_basics.py Loading commit data...
test_build_lib.py Loading commit data...
test_busing.py Loading commit data...
test_classes.py Loading commit data...
test_decorators.py Loading commit data...
test_functions.py Loading commit data...
test_lexer.py Loading commit data...
test_methods.py Loading commit data...
test_namespace.py Loading commit data...
test_parser.py Loading commit data...
test_shell.py Loading commit data...
test_stdlib.py Loading commit data...