Skip to main content

graph_grammar/
lib.rs

1//! graph-grammar ,a Rust crate + C-ABI `cdylib` exposing the graph-grammar rewrite
2//! engine to non-TypeScript callers. JSON in / JSON out, validated against the
3//! engine's zod-derived schema, with behaviour (including the seeded RNG)
4//! reproduced bit-for-bit and verified by the conformance suite.
5//!
6//! Module map:
7//!   types    ,serde data model (graph, rule, grammar) + ApiError
8//!   rng      ,Mulberry32 RNG, ported call-for-call from util.ts
9//!   schema   ,JSON-Schema validation at the boundary (the single contract)
10//!   graph    ,the mutable Host store (mirrors GraphIndex)
11//!   matching ,VF2++ subgraph matcher (match.ts)
12//!   rewrite  ,single-rule application (rewrite.ts)
13//!   engine   ,the stateful step/run loop (engine.ts)
14//!   api      ,one-shot apply entry points (deterministic + seeded)
15//!   ffi      ,the `gg_*` C ABI
16
17mod api;
18mod engine;
19mod ffi;
20mod graph;
21mod matching;
22mod rewrite;
23mod rng;
24mod schema;
25mod types;
26
27// Public Rust API (the C ABI lives in `ffi` and is exported by symbol). The
28// integration tests consume these.
29pub use api::{apply_rule, apply_rule_seeded};
30pub use engine::{run_grammar, Engine};
31pub use types::ApiError;