Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
aufbau
Typed constrained decoding engine.
This repository provides the Rust core and Python bindings (aufbau) used by downstream projects like p7.
Quick Start
Makefile Usage
Python FFI
Exported API (stubs in aufbau.pyi):
SPG(source)— load a grammar from.aufsourceSPG.build(productions, rules=[], rewrites=[], start=None, ty=None)— assemble structurally: a production is(name, rule, alternatives), a symbol("nt"|"lit"|"re", value, binding), a rule(name, premises, conclusion)in inference notation;tynames the type fragment (theTy*of the surface syntax)source()— render back to.aufstart,nonterminals(),productions(nt),nt_rule(nt),rule_names()tokenize(input),specials(),is_transparent(nt)parse_type(s),show(term),normalize(s),unify(a, b),unify_modulo(a, b),rewrites(),signature()completeness()— the realizability certificate as(kind, sorts):"syntactic"(no rules: live ⇔ realizable),"inhabited"(universal inhabitants everywhere: live ⇒ realizable), or"sound"with the sorts where a live prefix may be uninhabited
Synthesizer(spec_source, input="")Synthesizer.from_grammar(spg, input="")— reuse a built grammarparse(),feed(token),try_feed(token),set_input(input),input()mask(candidates)— the constrained-generation primitive: one bool per candidate continuation, no state changein_scope(expected=None)— in-scope names whose type unifies withexpected(the var rule's membership constraint as a type-filtered mask)status()—"typed" | "live" | "dead";root_type()— the typeTermadd_to_ctx(name, type),clear_ctx(),is_complete(),ast()get_rule(name),grammar()
Term— a type as a tree:label(),children(),is_var(),is_leaf(),is_con(),is_ground()Ast— parse resultroots,node_count(),is_complete(),input,type_of(evidence)
Regex(pattern)matches(text),prefix_match(prefix),derivative(text)is_empty(),is_nullable(),match_len(text),to_pattern()
PrefixStatuskind,regex,is_complete(),is_prefix(),is_extensible(),is_no_match()
Development
OCaml FFI
The engine is also exposed as native OCaml values (ocaml/aufbau.mli), built
inductively rather than through .auf source: type terms, rewrite theories,
unification, rule-level type expressions, typing rules, grammars, and the
Check module for running programs and prefixes against a grammar. Every
module and function in aufbau.mli carries its own doc comment; that file is
the authoritative reference.
Differential certification against OCaml
ocaml/cert.ml (with ocaml/oracle.ml as the trusted reference, built on
compiler-libs) checks aufbau's ml instance (examples/ml.auf) against
OCaml's own typechecker over a corpus that mirrors
src/validation/parseable/ml.rs, so the Rust suite and this harness pin the
same programs from both sides of the boundary. It certifies two claims:
- soundness — every program aufbau accepts, OCaml's compiler also accepts;
- agreement — on the monomorphic corpus, acceptance coincides exactly,
except at a documented fragment boundary (OCaml's
let-generalization of dead match branches) where aufbau is soundly stricter.
Runs as part of make test-ocaml / dune runtest --root ocaml.