[WIP] Symbol Table Abstraction#125
Open
iwillspeak wants to merge 11 commits into
Open
Conversation
Design doc 05 assumed a compiler-level Workspace wrapping SourceRegistry. The actual implementation removed SourceRegistry and made SyntaxRoot<'a> a self-contained value that carries its own TextDocument. Add doc 06 which: - Collapses the three-layer model to two (parse → compilation) - Describes Workspace as an LSP-layer actor only (WorkspaceAgent) - Defines FileCollection as a plain list of SyntaxRoot<Program> - Specifies Scope as the explicit input/output of binder entry points, enabling ergonomic REPL chaining without re-compiling from scratch - Proposes SymbolTable (Definition, Reference, Exports, Imports) on BoundSyntaxTree to model the semantic content of a bound program, as the foundation for LSP hover, go-to-definition, and find-references Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Ensures Claude Code reads the same agent configuration as other agents, including the build/test workflows, code style conventions, and skills. https://claude.ai/code/session_01Ue7rpYvC4DBAQLGCQMKagp
…nment) - Replace `Scope = Map<string, StorageRef>` shim in Environments.fs with a proper `Scope` record holding StxEnv, Bindings, Libs, and Macros; add `Scope.empty` and `Scope.ofLibraries` constructors. - Rework `Binder.bindProgram` / `bindScript` to accept and return `Scope`, threading output bindings and macros back to callers for REPL chaining. - Add `FileCollection` type alias and `FileCollection.ofPaths` / `ofRoots` helpers in Parse.fs; use `ofPaths` in `Compiler.compileFiles`. - Update `Compiler.compile` to build an initial `Scope` from library signatures and builtin macros instead of the old `Environments` shim API. - Update `BinderTests` and `LowerTests` to use the new `Scope`-based API. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
c5dec16 to
60eca14
Compare
iwillspeak
commented
May 4, 2026
| let missing = | ||
| { Doc = { Id = DocId.Synthetic; Path = "missing"; LineStarts = [] } | ||
| { Doc = | ||
| { Id = DocId.Synthetic |
Owner
Author
There was a problem hiding this comment.
Can we get rid of DocId now
iwillspeak
commented
May 4, 2026
| let macros, stxEnv = Builtins.loadBuiltinMacroEnv baseScope.StxEnv | ||
|
|
||
| let inputScope = | ||
| { baseScope with |
Owner
Author
There was a problem hiding this comment.
I feel like this Scope with stuff could be cleaner.
I also feel that the loadBuiltinMacro should perhaps just take and return a scope.
Add a `Compilation` record type that carries the lowered bound tree, output scope, and emit context (Target, RefTypes, Options) so that binding and emission can be decoupled. - `Compilation.create` resolves references, builds the initial scope, binds, and lowers — returning a `Compilation` without touching streams. - `Compilation.createDerived` does the same but inherits Target/RefTypes/ Options from a previous step and uses its OutputScope as the input, enabling each REPL line to see all prior top-level definitions. - `Compilation.emit` writes the lowered tree to a stream; skips emission when the bound tree has errors. - `Compilation.compile` becomes a one-liner over create + emit, so all existing call sites remain unchanged. - `Eval.evalWithPrev` uses create/createDerived/emit to evaluate a script and returns the resulting `Compilation` for the caller to thread forward. - `Repl.runRepl` now maintains `mutable state: Compilation option` and folds each input through `evalWithPrev`, accumulating scope across lines. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Documents aren't persisted into stores any longer. The DocID isn't neeeded.
REPL needs to know about incrementing the program index to give each successive REPL step a unique name. This doesn't need to be something that the compiler worries about though. Fixup dispose on eval's load context so that we do clean up assemblies once we've done with them. This will be important for Blazor.
Include the step in the prompt.
Replace the confusing `Compilation.create`/`createChained` pair with two explicit primitives: `Compilation.bind` (returns `BindResult`, no emission) and `Compilation.compile` (bind + emit in one step). The `compile` function takes a `CompileContext` DU — either `Fresh options` for a standalone build or `Chained(prevOutput, programName)` for REPL scope chaining — making the two modes of use a first-class part of the signature rather than separate function names. `CompileResult` is removed (it was unused outside the module). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Design doc 05 assumed a compiler-level Workspace wrapping SourceRegistry. The actual implementation removed SourceRegistry and made SyntaxRoot<'a> a self-contained value that carries its own TextDocument.
Add doc 06 which: