Skip to content

Added a Stack compiler frontend written in Rust - #1

Merged
konojunya merged 3 commits into
mainfrom
jj/add-rust-compiler-frontend
Sep 2, 2026
Merged

Added a Stack compiler frontend written in Rust#1
konojunya merged 3 commits into
mainfrom
jj/add-rust-compiler-frontend

Conversation

@konojunya

@konojunya konojunya commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Background

The purpose is to translate the canonical specification of the Stack language into an executable compiler frontend and prepare a pure Rust core that can be shared across browsers, CLI, and hosted services. The renderer, theme/icon resolution, layout, and HTTP are out of scope for this change.

Implementation Details

  • Implemented the lexer, recursive-descent parser, source AST, semantic validation, and normalized IR using Rust 2024 with no runtime dependencies.
  • Documented three ADRs covering the approach for the Rust core, AST/IR separation, and handwritten parser.
  • Implemented source spans and STK diagnostics, node/group/edge/layout/theme constraints for Stack 1.0, defaults, and complexity limits.
  • Banned panic-inducing operations such as unwrap and expect using Clippy.
  • Separated CI into main CI using the latest stable Rust/Cargo and MSRV CI using Rust 1.85.
  • Added actions/checkout v7, weekly Dependabot, and a 95% unit coverage gate.
  • Renderer, server, and theme/icon resolution remain unimplemented.

Testing Details

  • cargo +stable fmt --check
  • cargo +stable test
  • cargo +stable clippy --all-targets --all-features -- -D warnings
  • RUSTDOCFLAGS="-D warnings" cargo +stable doc --no-deps
  • cargo +stable llvm-cov --lib --all-features --workspace --fail-under-lines 95 --fail-under-functions 95 --fail-under-regions 95
  • cargo +1.85.0 test
  • cargo +1.85.0 clippy --all-targets --all-features -- -D warnings
  • Byte-level diff with the 4 examples from the canonical specification
  • 30 unit tests + 5 integration tests
  • Latest stable coverage: lines 98.62%, functions 98.86%, regions 97.71%

Review Points / Concerns

  • Is the separation of concerns between the source-oriented AST and normalized IR suitable for the future WASM/CLI boundary?
  • Is the diagnostic policy of stopping at the first syntax error while collecting semantic errors appropriate?
  • Is the policy of maintaining Rust 1.85 as the MSRV while using the latest stable as the main CI appropriate?
  • Are the boundaries appropriate regarding excluding theme/icon resolution, layout, and the SVG renderer from the compiler repository?

Define the Rust frontend architecture and implement parsing, semantic validation, normalized IR, diagnostics, tests, and CI quality gates.
@konojunya konojunya changed the title Rust製Stack compiler frontendを追加 Added a Stack compiler frontend written in Rust Sep 2, 2026
Run push checks only on main while keeping pull request checks targeted at main.
Avoid compiling the coverage tool from source on every workflow run.
@konojunya
konojunya merged commit 5477725 into main Sep 2, 2026
2 checks passed
@konojunya
konojunya deleted the jj/add-rust-compiler-frontend branch September 2, 2026 05:13
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