Skip to content

Commit 6553c17

Browse files
committed
feat: port own-syntax to Rust (lexer + parser + AST) with shared error-parity fixtures
P-022 migration step 2. The crate mirrors ownlang/{lexer,parser,ast_nodes}.py method for method; LexError/ParseError Display byte-identically to Python's str() (including a CPython repr() emulation for the quoted-token part). Parity is asserted from both sides of one corpus, tests/fixtures/syntax_parity.json: tests/test_syntax_fixtures.py is authoritative (regenerates via --write, fails when stale, runs in run_tests.py), and rust/crates/own-syntax/tests/parity.rs replays every case — exact error strings for rejections, a shared structural digest for accepts (full AST parity arrives with the CFG port and the oracle seam). Recorded divergences, both loud: digits are ASCII-only (Python's str.isdigit quirk not reproduced), integer literals cap at u64 (reject instead of truncate). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TSqD7TSzxAnGWszaFwTZVt
1 parent 1c481e9 commit 6553c17

12 files changed

Lines changed: 2342 additions & 2 deletions

File tree

‎rust/Cargo.lock‎

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎rust/Cargo.toml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
[workspace]
1010
resolver = "2"
11-
members = ["crates/own-ir"]
11+
members = ["crates/own-ir", "crates/own-syntax"]
1212

1313
[workspace.package]
1414
edition = "2021"

‎rust/crates/own-syntax/Cargo.toml‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "own-syntax"
3+
description = "OwnLang lexer + recursive-descent parser + AST, error-message-parity port of ownlang/{lexer,parser,ast_nodes}.py"
4+
edition.workspace = true
5+
rust-version.workspace = true
6+
license.workspace = true
7+
publish.workspace = true
8+
version = "0.1.0"
9+
10+
[dev-dependencies]
11+
serde_json = { workspace = true }
12+
13+
[lints]
14+
workspace = true

0 commit comments

Comments
 (0)