Skip to main content

Crate bock_codegen

Crate bock_codegen 

Source
Expand description

Bock codegen — target-specific code generation from typed Bock AIR.

This crate provides the target profile system and code generator framework. Each supported transpilation target (JS, TS, Python, Rust, Go) is described by a TargetProfile with a capability matrix, and target-specific code generators implement the CodeGenerator trait.

Re-exports§

pub use ai_synthesis::cache_at;
pub use ai_synthesis::needs_ai_synthesis;
pub use ai_synthesis::synthesize_and_flush;
pub use ai_synthesis::verify_generated;
pub use ai_synthesis::AiSynthesisDriver;
pub use ai_synthesis::SynthesisConfig;
pub use ai_synthesis::SynthesisOutcome;
pub use ai_synthesis::SynthesisStats;
pub use error::CodegenError;
pub use gaps::detect_gaps;
pub use gaps::CapabilityGap;
pub use generator::CodeGenerator;
pub use generator::GeneratedCode;
pub use generator::OutputFile;
pub use generator::SourceInfo;
pub use generator::SourceMap;
pub use generator::SourceMapEntry;
pub use generator::SourceMapping;
pub use go::GoGenerator;
pub use js::JsGenerator;
pub use profile::classify_node;
pub use profile::AsyncModel;
pub use profile::ErrorHandling;
pub use profile::GenericsModel;
pub use profile::IndentStyle;
pub use profile::MemoryModel;
pub use profile::NamingConvention;
pub use profile::NodeKindHint;
pub use profile::Support;
pub use profile::TargetCapabilities;
pub use profile::TargetConventions;
pub use profile::TargetProfile;
pub use py::PyGenerator;
pub use rs::RsGenerator;
pub use ts::TsGenerator;

Modules§

ai_synthesis
Tier 1 AI synthesis — selective invocation, confidence gating, and decision recording (§17.2, §17.3, §17.4).
error
Codegen error types.
gaps
Capability gap detection — identifies mismatches between AIR constructs and target support.
generator
Code generator trait and output types.
go
Go code generator — rule-based (Tier 2) transpilation from AIR to Go.
js
JavaScript code generator — rule-based (Tier 2) transpilation from AIR to JS.
profile
Target profile definitions — capability matrices and conventions for each target language.
py
Python code generator — rule-based (Tier 2) transpilation from AIR to Python.
rs
Rust code generator — rule-based (Tier 2) transpilation from AIR to Rust.
ts
TypeScript code generator — rule-based (Tier 2) transpilation from AIR to TS.

Structs§

Rule
A single pattern-template mapping for deterministic codegen.
RuleCache
On-disk rule cache rooted at <project_root>/.bock/rules/.