Skip to main content

bock_codegen/
lib.rs

1//! Bock codegen — target-specific code generation from typed Bock AIR.
2//!
3//! This crate provides the target profile system and code generator framework.
4//! Each supported transpilation target (JS, TS, Python, Rust, Go) is described
5//! by a [`TargetProfile`] with a capability matrix, and target-specific code
6//! generators implement the [`CodeGenerator`] trait.
7
8pub mod ai_synthesis;
9pub mod error;
10pub mod gaps;
11pub mod generator;
12pub mod go;
13pub mod js;
14pub mod profile;
15pub mod py;
16pub mod rs;
17pub mod scaffold;
18pub mod ts;
19
20// Re-export primary public API at crate root.
21pub use ai_synthesis::{
22    cache_at, needs_ai_synthesis, synthesize_and_flush, verify_generated, AiSynthesisDriver,
23    SynthesisConfig, SynthesisOutcome, SynthesisStats,
24};
25pub use bock_ai::{Rule, RuleCache};
26pub use error::CodegenError;
27pub use gaps::{detect_gaps, CapabilityGap};
28pub use generator::{
29    arm_body_is_statement, classify_assertion, collect_test_fns, desugared_self_call, fn_is_test,
30    hoist_value_cf, js_ts_generate_tests, loop_needs_break_label, match_has_statement_arm,
31    node_is_statement, param_binds_self, value_cf_diverges, CodeGenerator, GeneratedCode,
32    JsTsExprEmitter, OutputFile, SourceInfo, SourceMap, SourceMapEntry, SourceMapping,
33    TestArtifacts, TestAssertion, DECL_ONLY_META,
34};
35pub use go::GoGenerator;
36pub use js::JsGenerator;
37pub use profile::{
38    classify_node, AsyncModel, ErrorHandling, GenericsModel, IndentStyle, MemoryModel,
39    NamingConvention, NodeKindHint, Support, TargetCapabilities, TargetConventions, TargetProfile,
40};
41pub use py::PyGenerator;
42pub use rs::RsGenerator;
43pub use scaffold::{
44    effective_test_framework, run_scaffolder, scaffolder_for, ScaffoldConfig, ScaffoldContext,
45    ScaffoldError, Scaffolder, TargetScaffoldConfig, SCAFFOLD_TARGETS,
46};
47pub use ts::TsGenerator;