Skip to content

Commit d3226f6

Browse files
hellovaiclaude
andauthored
Add foundational BAML language compiler infrastructure (#2684)
Set up the core compiler pipeline with lexer, parser, HIR, THIR, and codegen stages, organized as a Rust workspace with modular crates for each compilation phase. Includes comprehensive test infrastructure with snapshot testing and benchmarks for compiler performance. RUN_CODSPEED=1 <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduces a modular Rust workspace for the BAML compiler (lexer→parser→HIR→THIR→codegen) with diagnostics, auto-generated snapshot tests and CodSpeed benchmarks, and comprehensive CI plus dev hooks. > > - **BAML Language Workspace**: > - Add Rust workspace `baml_language` with crates: `baml_base`, `baml_lexer`, `baml_parser`, `baml_syntax`, `baml_hir`, `baml_thir`, `baml_codegen`, `baml_workspace`, `baml_diagnostics`, `baml_db`. > - Implement lossless lexer (Logos), stub parser (Rowan), syntax kinds/nodes, HIR/THIR data structures and helpers, diagnostics rendering (Ariadne), and bytecode model stubs. > - **Tests & Benchmarks**: > - New `baml_tests` crate with build script to auto-generate snapshot tests from `projects/` and instrumented benchmarks from `benches/` (incremental and scale scenarios). > - Add snapshots, benchmark datasets, and bench harness (CodSpeed-compatible). > - **CI/CD**: > - Add `.github/workflows/ci.yaml` running fmt, clippy, tests (Linux/macOS/Windows), WASM build, MSRV check, cargo-deny, snapshot tests, and CodSpeed benchmarks (opt-in via flags/paths). > - **Dev Tooling**: > - Add git pre-commit hook setup (`scripts/setup-hooks.sh`) and docs; workspace `rustfmt.toml`, `rust-toolchain.toml`, `deny.toml`; update `.gitignore`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 3491f84. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Claude <[email protected]>
1 parent 38cfe9b commit d3226f6

File tree

87 files changed

+6080
-1
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+6080
-1
lines changed

.github/workflows/ci.yaml

Lines changed: 552 additions & 0 deletions
Large diffs are not rendered by default.

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ $RECYCLE.BIN/
116116
/out/
117117
engine/language_client_ruby/**/*.bundle
118118
engine/target/
119-
Cargo.lock
120119
Icon
121120
Network Trash Folder
122121
Temporary Items
@@ -175,3 +174,4 @@ trace_events_debug.json
175174

176175
result
177176

177+
target/

baml_language/.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Additional target directories that don't invalidate the main compile cache when changing linker settings,
2+
# e.g. `CARGO_TARGET_DIR=target-maturin maturin build --release --strip` or
3+
# `CARGO_TARGET_DIR=target-llvm-lines RUSTFLAGS="-Csymbol-mangling-version=v0" cargo llvm-lines -p ruff --lib`
4+
/target*

0 commit comments

Comments
 (0)