feat(oxabl_semantic): crate skeleton and declare pass (Phase 3)#49
Merged
Conversation
Introduces the oxabl_semantic crate — the first semantic analysis layer for oxabl. v1 ships the declare pass plus the scaffolding every subsequent pass will build on: - Scope tree: arena-allocated ScopeTree, Scope, ScopeKind covering every parser-produced construct (file root, procedure, function, class, method, property accessors, constructor/destructor, blocks, catch/finally, triggers, frame, trigger procedure). - BindingMap: Small/Large enum with linear-scan inline storage up to 8 bindings (the majority case in ABL per the plan), spilling to a hashmap past the cap. - Symbol table: SymbolId arena + bitflags SymbolFlags covering access modifier, static/abstract/final/override, NO_UNDO, parameter direction, and SHARED/NEW SHARED/NEW GLOBAL SHARED. Stores case-folded OxablAtom; display casing reconstructed from span at diagnostic time. - Namespace: NamespaceId enum with 10 variants + NUM_NAMESPACES. Scopes carry [BindingMap; NUM_NAMESPACES] indexed by discriminant. - Types: ResolvedType + PrimitiveTy, with DataType→ResolvedType lowering used by the declare pass for typed declarations. - Builtins: five ambient names seeded into the file scope per plan. - Declare pass (resolve.rs, declare half): walks every declaration-emitting statement, opens the right scope, records the symbol, tracks flags. Emits SEM0001 (duplicate), SEM0003 (BLOB/CLOB local). SEM0002 reserved for Phase 4a when SHARED-mismatch becomes visible. - NodeIndexVec side table: dense Vec-backed side table keyed by NodeId, seeded (empty) for references + types so Phase 4a/4b plug into an existing shape without reworking Semantic. Also lands: - oxabl_common::VirtualSpan newtype — post-preprocessor offsets; the plan calls out VirtualSpan/FileSpan distinction as load-bearing and this is the only dependency the semantic layer needs from oxabl_common for spans. Tests: 66 inline tests in oxabl_semantic (47 covering every declaration form in the declare pass, 19 covering supporting data structures). Zero serde_json dependency per plan.
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
Ships Phase 3 of the semantic layer v1 plan (docs/plans/2026-04-16-004-feat-semantic-layer-v1-plan.md): the `oxabl_semantic` crate skeleton plus the declare pass.
Testing
Post-Deploy Monitoring & Validation
No additional operational monitoring required: `oxabl_semantic` is a library crate with no runtime, network, or on-disk state. Correctness is verified by the 66 inline tests and workspace CI; there is no service to observe after merge.
Plan linkage