bock intent <||> context

A feature-declarative programming language.

Compiles to JavaScript, TypeScript, Python, Rust, and Go. No runtime to ship.

Section 01 / Signature

Behavior in the signature

A function in Bock declares its contract in the signature. Types, effects, and the relationship between input and output are visible before you read the body. The body is the work, expressed as a pipeline. Effects are named interfaces with operations; functions that use them say so. Handlers are injected at the call site, not imported as globals.

main.bock BOCK
module main

public record Document {
  id: String
  text: String
  category: String
  quality: Float
}

public effect Logger {
  fn log(message: String) -> Void
}

public effect Storage {
  fn read(key: String) -> Optional[String]
  fn write(key: String, value: String) -> Void
}

public fn normalize(doc: Document) -> Document {
  Document {
    id: doc.id
    text: doc.text.trim().to_lower()
    category: doc.category
    quality: doc.quality
  }
}

public fn validate(doc: Document) -> Bool {
  doc.text.length() > 0 && doc.category.length() > 0
}

public fn quality_filter(docs: List[Document]) -> List[Document] {
  docs.filter((d) => d.quality > 0.5)
}

public fn normalize_all(docs: List[Document]) -> List[Document] {
  docs.map(normalize)
}

public fn validate_filter(docs: List[Document]) -> List[Document] {
  docs.filter((d) => validate(d))
}

public fn prepare_documents(docs: List[Document]) -> List[Document] with Logger, Storage {
  log("preparing ${docs.length()} documents")
  docs
    |> quality_filter
    |> normalize_all
    |> validate_filter
}

The same source compiles to JavaScript, TypeScript, Python, Rust, and Go.

Section 02 / Targets

One source, many targets

Bock compiles to five target languages. Deploy to one target, or compile to several at once. Each `bock build -t <target>` writes source files in that language to your output directory. Drop them into your project the way you drop in any other source.

  • JavaScript the default for ecosystem reach. Node services, browser code, build tooling.
  • TypeScript typed code for larger codebases and team work. Generated with full type signatures.
  • Python the language of one of the largest developer communities. Scripts, data work, scientific code.
  • Rust systems-grade output for performance and embedded work. Idiomatic ownership and trait-based code.
  • Go the right pick when deployment simplicity or concurrency matters. Standard interface-based code.

Your target language is the source you deploy. No Bock runtime, no shims.

Section 03 / Runtime

Ship your target, not Bock

Most cross-platform languages add a runtime: a virtual machine, a translation layer, a library your program depends on at execution time. Bock doesn't. The output of a Bock build is plain code in the target language, ready to drop into your existing project. Run it on Node, ship it as a Python package, link it into a Rust binary, deploy it as a Go service. The Bock runtime supports development; it does not ship. Your target ships.

Section 04 / Compilation

AI in compilation, not in your runtime

AI is a guarded tool inside Bock's compilation toolchain, used at specific stages, contained, constrained, and verified on either side. The pipeline itself is deterministic from parsing through type checking, ownership analysis, effect tracking, and target lowering. AI enters where rule-based translation can't bridge a gap between languages, or where idiomatic target code requires choices that fixed templates can't make. The compiler calls an AI model at those points, accepts the result only if it passes verification, logs the decision, and falls back to rule-based generation if the model is unavailable. This is not codified prompt engineering, and it is not autonomous code generation. Every AI decision is reviewable and overridable. In production builds, every decision is pinned, and the compiler replays stored choices instead of consulting the model.

Strictness levels govern how AI participates in a build. In sketch mode, the compiler may consult AI for default choices when the source is incomplete. In development mode, AI assists at known capability gaps and idiomatic synthesis points. In production mode, every decision the compiler will ever make is recorded in a manifest committed to your repository; the compiler replays those decisions identically and never consults the model. Builds are reproducible; AI is auditable; the developer remains in control.

Install Bock, write a function, see what compiles.

Start building