Lower twill-parser's borrowed AST to an owned/interned tree #43
Labels
No labels
bug
design
epic
risk
user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
jacksonopp/twill#43
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
twill-parser's Expr<'src> is zero-copy, borrowing from the source &str. Salsa's tracked-struct outputs need to be cheaply Eq/hashable for early-cutoff, and threading twill-parser's 'src lifetime through salsa's 'db-bound tracked structs fights the framework for no benefit.
Decided in #1's discussion: immediately after parsing, lower the borrowed Spanned<Expr<'src>> into an owned tree, and intern identifiers as a Symbol type (via salsa::interned) from the start rather than starting with plain owned Strings. Reasoning: interned symbols give stable identity across revisions, which is what makes structural Eq on the lowered tree actually early-cutoff unrelated queries, and Step 2's type checker will want Symbol-shaped identifiers for the symbol table anyway -- deferring interning just means redoing this once Step 2 lands.
Scope: define the lowering module/pass and the Symbol interned type; everything else in the lowered tree stays plain owned data for now.