Skip to content

Add streamed self-hosted lexer experiment - #371

Merged
julia-script merged 1 commit into
mainfrom
julia/self-hosted-stream-lexer
Sep 7, 2026
Merged

Add streamed self-hosted lexer experiment#371
julia-script merged 1 commit into
mainfrom
julia/self-hosted-stream-lexer

Conversation

@julia-script

@julia-script julia-script commented Sep 6, 2026

Copy link
Copy Markdown
Owner

What changed

Add an experimental self-hosted lexer under compiler/. It reads one normalized relative Silk source path, borrows the file bytes, and exposes tokenization through Stream<Token, never ? never>.take without retaining a token vector.

The lexer follows the current bootstrap compiler for keywords, trivia, longest-match punctuation including ..., lifetimes, numeric and duration literals, static and character literals, invalid regions, focused LEX0001LEX0012 diagnostics, and one-shot EOF behavior. The CLI prints each token and diagnostic directly to stdout.

The application edge uses the current source-owned OsFileSystem and StdoutWriter providers. With the JUL-152 repair now on main, the host-input, filesystem, and writer operations remain in one sequential program body without the earlier helper-splitting workaround.

For example:

silk run --manifest-path compiler/silk.toml -- compiler/fixtures/empty.silk

prints:

EndOfFile 0..0

The project includes focused fixtures, usage documentation, and the compiler limitations found while writing real Silk code. Follow-up work is tracked in JUL-153, JUL-154, and JUL-155; JUL-152 is recorded as resolved on current main.

Validation

  • Rebased onto dd4510fa
  • silk check --manifest-path compiler/silk.toml
  • Native build of the 347-symbol lexer
  • Exact differential comparison with the current bootstrap lexer across all six fixtures: token kinds, byte spans, diagnostic codes, reason tags, and diagnostic spans
  • Lossless span coverage and one zero-width EOF per fixture
  • Missing, extra, absolute, dot-component, parent-component, missing-file, and unreadable-file argument/path cases rejected
  • pnpm check

@vercel

vercel Bot commented Sep 6, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
silk-effect-docs Ready Ready Preview Sep 7, 2026 3:31am UTC

Request Review

@julia-script
julia-script force-pushed the julia/self-hosted-stream-lexer branch from 3935b68 to 45280be Compare September 7, 2026 03:30
@julia-script
julia-script merged commit 649acca into main Sep 7, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant