Repository navigation
feat: package layout alignment and lexical scope analysis - #4
Merged
Merged
Conversation
Move import binding and canonical symbols into semantic/, HIR-to-PyIR lowering into ir/, and expose frontend.build_hir as the only public frontend entry point so parser objects never leave the frontend. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Represent global and nonlocal declarations, class definitions and list, set and generator comprehensions so scope analysis can be built from PyHIR. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Build an immutable scope tree from PyHIR with Python resolution rules: whole-function locality, global and nonlocal redirection, class bodies skipped by nested functions, and comprehension scopes. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Lowering no longer tracks locals itself: names are classified by the semantic ScopeAnalysis, so a name assigned anywhere in a function is local for the whole function and only module-level bindings can resolve to canonical import symbols. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
6 tasks done
SizzleUnrlsd
added a commit
that referenced
this pull request
Sep 3, 2026
feat: package layout alignment and lexical scope analysis
8 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Opens Phase 2 of
docs/architecture.md(§4.1 ScopeAnalysis) and closes the Phase 1 repository-layout item (§37).--emit-irintegration.semantic/package: import binding and canonical symbols move out offrontend; HIR→PyIR lowering moves intoir;frontend.build_hiris the only public frontend entry point, so noastobject crosses the CLI.Global,Nonlocal,ClassandComprehensionnodes.semantic/scopes.py: immutable scope tree with Python resolution rules (whole-function locality,global/nonlocal, class bodies skipped by nested functions, comprehension scopes).Roadmap
SymbolAnalysisand non-python.namespaces remain.Verification
python -m mypy && python -m ruff check . && python -m pytest— 74 passed.Not lowered yet, with a source-located diagnostic: free variables in nested functions, assignment to
global/nonlocalnames, classes and comprehensions inside functions. They wait on the Phase 3 CFG and PyIR instructions.🤖 Generated with Claude Code