CRAFT is a thin, unambiguous wrapper language designed from the ground up for LLMs and AI agents to generate, verify, and debug code — while transpiling 1:1 to clean, high-performance C++20 with zero runtime overhead.
Traditional languages optimize for human writers.
CRAFT optimizes for machines that now write most code.
CRAFT enforces a single canonical way to express every construct ("One Way Only"), embeds contracts (@prove) and mandatory runtime shadow tests (@test) directly into the grammar, maps explicitly to C++ RAII memory semantics, and provides verified escape hatches (cpp { }) for unsafe operations.
It prioritizes low token entropy and predictability so LLMs produce correct, deterministic code on the first pass.
A built-in --human mode produces annotated pseudo-C++ with inline comments explaining contracts, ownership semantics, error propagation (?), and trace instrumentation — making AI-generated code easy for humans to review without learning CRAFT syntax.
- Machine-first design: Unambiguous grammar with exactly one way to do everything
- Mandatory contracts & tests:
@proveand@testare part of the syntax — untested code is invalid - Safe by default: Raw pointers and unsafe ops require explicit
cpp { }escape - Zero-cost abstractions:
own<T>→std::unique_ptr,ref<T>→const T&,Result<T,E>→std::expected - Verified C++ interop:
extern from "header"checked with libclang - First-class debugging:
@tracestructured logs +#linedirectives for GDB/LLDB - Human bridge:
--humanmode generates richly annotated pseudo-C++ for easy review - Proven with evaluation: A/B testing shows generated CRAFT achieves 100% correctness and test coverage versus 85% correctness for raw C++.
Full locked principles → PRINCIPLES.md
CRAFT has a tiny, context-free grammar (24 EBNF rules, 0 ambiguous parses).
- Full grammar and lexical rules →
GRAMMAR.md - Curated examples with grammar coverage →
GRAMMAR.md - Full, ready-to-use example files →
examples/directory
LLM generates CRAFT → craft transpile --human produces annotated C++ with:
- Contract explanations (
@prove) - Ownership transfer notes
?error propagation paths- Trace instrumentation markers
- Source line mapping
See HUMAN_BRIDGE.md for details and the recommended review workflow.
See EVALUATION.md for A/B test results showing CRAFT's generated correctness and test coverage gains.
The transpiler implementation lives in transpiler/ and includes parser, codegen prototype, and validation tests.
transpiler/README.mddocuments the current parser/codegen approach.transpiler/test_e2e.py,transpiler/test_lexer.py, andtranspiler/test_parser.pyexercise the engine.- The current focus is evolving the C++ codegen prototype from the locked CRAFT grammar.
- Read
MEMORY.md,PRINCIPLES.md, andGRAMMAR.md. - Use
TRANSLATE_PROMPT.mdfor C++ → CRAFT translation. - Follow one training round from
TRAINING_LOOP.mdand run cleanup:- Windows:
./cleanup.ps1 - macOS/Linux:
./cleanup.sh
- Windows:
- Sanity-check
examples/,seeds/cpp/,transpiler/, anddataset/. - Open a PR with a short summary of what changed and why, using
.github/PULL_REQUEST_TEMPLATE.md.
Recommended end-to-end flow for contributors and developers:
- Read core docs:
- Run one training round process from
TRAINING_LOOP.mdand produce/updatetraining_round*.json. - Run cleanup to normalize artifacts:
- Windows:
./cleanup.ps1 - macOS/Linux:
./cleanup.sh
- Windows:
- Review outputs:
dataset/for canonical extracted corporaseeds/cpp/for high-quality start pointsexamples/for showcase CRAFT examplestranspiler/for parser and codegen validationTODO.mdfor unresolved follow-ups
- Commit changes on a branch and open a pull request.
- Phase 1 Complete: Vision, principles, grammar, human bridge, and translation tools locked.
- A/B evaluation validated:
EVALUATION.mdreports 100% correctness and 100% test coverage for generated CRAFT versus 85% correctness and 0% tests for raw C++. - Round 4 Complete: Grammar stable with 0 gaps in 50-problem test set. Stdlib finalized (Vec.sort, Set.remove, Map.remove, abs).
- Transpiler prototype active: handlers generics, enums, match,
?propagation,@trace,--humanmode, and OOP (impl blocks with member functions). Seetranspiler/README.md.
See v2-roadmap.md for deferred features (structured concurrency, auto-generated bindings, C++23 opt-in).
This is an early-stage passion project 🍺 exploring better tools for AI-generated systems code.
CRAFT/
Docs— core design, grammar, reference, evaluation, workflow, and roadmaptranspiler/— parser and C++ codegen prototype with validation testsdataset/— canonical raw C++ corpus, translated CRAFT corpus, and human-readable notesexamples/andseeds/cpp/— polished showcase examples and high-quality C++ seedstraining_data/— active refinement rounds and completed archivecleanup.ps1,cleanup.sh,cleanup.md— artifact cleanup and normalization
Contributions are very welcome! Especially helpful right now:
- More C++ → CRAFT translation examples
- Feedback on grammar clarity and LLM generation quality
- Early parser or codegen help (Tree-sitter, Lark, Rust, etc.)
- Ideas for improving the
--humandecompiler
Please read the locked documents (PRINCIPLES.md and GRAMMAR.md) before proposing changes so we stay aligned with the machine-first philosophy.
Use .github/PULL_REQUEST_TEMPLATE.md for the PR checklist and contribution guidance.
Created: April 2026 | Last updated: May 31, 2026
CRAFT — Because AI deserves a better language to write in. 🍺