Skip to content

feat: migrate Silver compiler frontend to standalone Elise parsing engine - #19

Merged
CierCier merged 15 commits into
mainfrom
migrate/elise
Aug 27, 2026
Merged

CierCier merged 15 commits into
mainfrom
migrate/elise

Conversation

@CierCier

@CierCier CierCier commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Overview

This pull request completes the migration of the Silver systems programming language compiler (agc) from the legacy hand-written parser to Elise, a high-performance, lossless CST parsing engine.

Key Changes

  1. Standalone Elise Decoupling:

    • Subscribed agc to https://github.com/CierCier/elise.git (elise-core, elise-lex, elise-parse).
    • Restructured workspace layout (bin/agc, bin/aglsp, bin/agsm).
    • Clean decoupling: zero Silver-specific types or dependencies in the Elise engine.
  2. Lossless CST $\to$ AST Lowering Pipeline:

    • Implemented lower_source_graph in bin/agc/src/grammar/lower.rs to lower lossless green trees into typed Silver ast::Program items.
    • Replaced legacy parsing in bin/agc/src/driver.rs and module import lowering in bin/agc/src/parser/import_hook.rs.
    • Verified 100% AST parity against all 269 corpus files in tests/elise_ast_parity.rs.
  3. Performance Improvements:

    • 3.57× End-to-End Speedup: Full corpus compilation frontend reduced from 64.12 ms to 17.98 ms.
    • >2.1 Million lines/sec parsing throughput.
    • 3.60× Lexer Speedup: Full corpus lexing reduced from 18.19 ms to 5.06 ms (237.8 MiB/s).

Verification & Test Results

  • cargo test --workspace: 451 tests passed, 0 failed.
  • bash tests/run_tests.sh: 144 integration test suites passed, 0 failed (all RAII, move semantics, destructor flags, memory stress, and runtime networking suites).
  • Standalone Elise Test Suite: All 23 tests across 5 packages passed in CierCier/elise.

Greptile Summary

The PR migrates the Silver compiler frontend to the standalone Elise lexer and CST parser while retaining the existing typed AST and downstream compiler stages.

  • Moves the workspace binaries under bin/.
  • Adds Elise-backed parsing and CST-to-AST lowering for compiler and import paths.
  • Adds corpus parity tests and frontend performance benchmarks.

Confidence Score: 5/5

The PR appears safe to merge because no blocking failure remains established at the current head.

No blocking failure remains.

Important Files Changed

Filename Overview
bin/agc/src/driver.rs Replaces the legacy root-input parser with Elise parsing and CST-to-AST lowering while rendering source-graph errors before downstream stages.
bin/agc/src/grammar/lower.rs Introduces the compatibility boundary that converts Elise source graphs into the existing Silver AST consumed by imports, semantics, and code generation.
bin/agc/src/grammar/parser.rs Defines the Elise-backed Silver source-graph parser and its syntax-error collection path.
bin/agc/src/parser/import_hook.rs Migrates imported Silver source parsing to the same Elise source-graph and AST-lowering pipeline.
bin/agc/Cargo.toml Adds the standalone Elise Git dependencies and Criterion benchmark configuration.
Cargo.toml Updates workspace membership for the new bin/agc, bin/aglsp, and bin/agsm locations.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  Source[Silver source] --> EliseLex[Elise lexer]
  EliseLex --> CST[Lossless source graph]
  CST --> Lower[CST to Silver AST lowering]
  Lower --> Imports[Import lowering]
  Imports --> Semantic[Semantic and ownership checks]
  Semantic --> Codegen[LLVM code generation]
Loading

Reviews (2): Last reviewed commit: "fix(ci, diagnostics): address review fee..." | Re-trigger Greptile

Context used:

Copilot AI lite review requested due to automatic review settings August 27, 2026 10:03
Comment thread bin/agc/src/driver.rs Resolved
Comment thread Cargo.toml Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

It introduces build- and tooling-impacting regressions (missing Elise paths via workspace patching, dropped parse diagnostics, and invalid LSP token encoding edge cases) that should be fixed before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This pull request migrates the Silver compiler workspace to a new bin/* layout and integrates the standalone Elise parsing engine into agc, alongside new/expanded tooling (LSP + module builder) and corpus-based parity/perf gates.

Changes:

  • Reworks the workspace layout to bin/agc, bin/aglsp, and bin/agsm, with updated repository docs and performance logs.
  • Introduces Elise-based source graph parsing plus corpus-wide parity/round-trip tests and benchmark harnesses.
  • Adds/extends tooling: LSP features (semantic tokens, references, outline, formatting, inlay hints) and agsm build pipeline.
File summaries
File Description
TODO.md Elise roadmap and milestone checklist
README.md Updates repo layout documentation
PERFLOG.md Adds Elise perf benchmark entries
Cargo.toml Switches workspace members; adds Elise patch override
AGENTS.md Updates architecture/layout documentation
bin/agsm/Cargo.toml New agsm crate manifest
bin/agsm/src/main.rs agsm CLI entrypoint (clap)
bin/agsm/src/lib.rs agsm library module exports
bin/agsm/src/build.rs Sourcemap build orchestration
bin/agsm/src/extract.rs Extends artifact extraction struct init
bin/aglsp/Cargo.toml New aglsp crate manifest
bin/aglsp/src/main.rs LSP server wiring + capabilities
bin/aglsp/src/util.rs LSP position/span utilities
bin/aglsp/src/semantic_tokens.rs LSP semantic token encoding
bin/aglsp/src/references.rs Find-references + rename logic
bin/aglsp/src/inlay_hints.rs Parameter/type inlay hints + tests
bin/aglsp/src/format.rs Whitespace-only formatter + tests
bin/aglsp/src/document_symbols.rs Outline/document symbols + tests
bin/aglsp/src/doc.rs Doc comment parsing/rendering
bin/aglsp/src/diagnostics.rs LSP diagnostics + import/cfg pipeline
bin/aglsp/src/completion.rs Adjusts repo-root discovery in tests
bin/agc/Cargo.toml Adds Elise git deps + criterion bench config
bin/agc/Cargo.lock Adds nested lockfile under bin/agc/
bin/agc/build.rs Build script exports git metadata env vars
bin/agc/benches/corpus.rs Corpus benchmark harness (legacy vs Elise)
bin/agc/.gitignore Ignores .o/.out artifacts
bin/agc/tests/elise_source_graph.rs Corpus lossless source graph test
bin/agc/tests/elise_item_parity.rs Corpus item parity vs legacy parser
bin/agc/tests/elise_ast_parity.rs AST parity smoke tests
bin/agc/src/lib.rs Exposes new grammar module
bin/agc/src/main.rs New agc binary entrypoint + argv normalization
bin/agc/src/driver.rs Driver switches parse path to Elise hooks
bin/agc/src/grammar/mod.rs Grammar module boundary + exports
bin/agc/src/grammar/parser.rs Elise token-stream item parser to SourceGraph
bin/agc/src/grammar/lower.rs SourceGraph → typed AST lowering stub
bin/agc/src/symbol_table.rs New compiler symbol table implementation
bin/agc/src/parser/mod.rs Parser module re-exports + comment extraction
bin/agc/src/parser/error.rs Parse error types + suggestion helpers
bin/agc/src/parser/prt_table.rs PRT grammar DSL + prediction table
bin/agc/src/parser/prt_parser.rs Adds single-item parse entrypoint
bin/agc/src/parser/import_hook.rs Import lowering now uses Elise graph + lowering
bin/agc/src/semantic/mod.rs Re-exports semantic passes
bin/agc/src/semantic/typeck.rs Updates repo-root discovery in tests
bin/agc/src/mangling.rs Collision-safe symbol mangling + tests
bin/agc/src/intrinsics.rs Adds atomic intrinsic name recognizer
bin/agc/src/link.rs Linker orchestration + dynamic linker handling
bin/agc/src/diagnostics/mod.rs New diagnostic renderer + typo suggestion utils
bin/agc/src/debug_info.rs Debug info context + SourceMap utilities
bin/agc/src/codegen/mod.rs Codegen API surface definitions
bin/agc/src/codegen/llvm_ir/mod.rs LLVM IR generator state + structures
bin/agc/src/codegen/llvm_ir/json.rs JSON macro codegen helpers
bin/agc/src/codegen/dwarf_bt.rs Adjusts test paths for new layout
bin/agc/src/cfg.rs New --cfg machinery + gating tests
bin/agc/src/attributes.rs Attribute parsing/helpers + tests
bin/agc/src/format.rs Type/attribute formatting utilities
Review details

Suppressed comments (2)

bin/agc/src/driver.rs:883

  • The main compile pipeline no longer reports parse errors: it sets errors to an empty vec and the existing error-reporting branch is now dead code, so invalid input may proceed with an empty/partial AST without any diagnostics.
    bin/agc/src/parser/import_hook.rs:363
  • Import parse failures now return a raw joined message string, losing the previous spanned diagnostic rendering (file:line:col + caret) that made import errors actionable.
  • Files reviewed: 23/95 changed files
  • Comments generated: 3
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread Cargo.toml Resolved
Comment on lines +1 to +3
//! The Silver grammar definition, expressed through elise.//!
//! This module is the boundary between the generic elise engine and the
//! Silver language: it owns the lexical spec (see [`lexspec`]) and the
Comment on lines +9 to +19
pub fn lower_source_graph(graph: &SourceGraph, file_id: usize) -> Program {
let src = graph.text();
let root = graph.root();
let mut comments = Vec::new();

let root_span = Span::new(root.span().0, root.span().1);

let all_tokens = match crate::lexer::lex_with_source(src, file_id as u32) {
Ok(toks) => toks,
Err(_) => Vec::new(),
};
…ax errors with spans and fixing CI git dependency resolution
@CierCier
CierCier merged commit cd581c3 into main Aug 27, 2026
2 checks passed
@CierCier
CierCier deleted the migrate/elise branch August 27, 2026 10:34
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.

2 participants