Bock
A feature-declarative programming language. Compiles to JavaScript, TypeScript, Python, Rust, and Go. No runtime to ship.
What Bock is
A function in Bock declares what it does, what types it operates on, what
effects it has, and what guarantees it requires. Annotations and
signatures carry the intent; the body carries the work. The compiler
resolves the rest. A function annotated @concurrent becomes
Promise.all in JavaScript, tokio::join! in Rust, and goroutines in Go.
An effect declared with with Log becomes a structured logger parameter
in every target. The same source describes the program. The compiler
describes how each target should run it.
Most cross-platform languages add a runtime: a virtual machine, a
translation layer, a library your program depends on at execution time.
Bock does not. 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.
Status
Bock is at v1.0 and under active development. The compiler pipeline runs
end to end: the CLI (bock) scaffolds, checks, builds, runs, tests, and
formats projects; the interpreter executes source directly for fast
iteration; codegen emits all five targets as per-module native source
trees; the v1 standard library (11 core modules) executes across every
target; and the website and VS Code extension build from this repo. The
work in flight is codegen polish for real-world programs: a focused
conformance suite passes on all five targets, while the broader example
programs are being hardened target by target (tracked in
STATUS.md and ROADMAP.md).
AI participates in compilation, not at your program's runtime. The
pipeline is deterministic from parsing through type checking, ownership
analysis, effect tracking, and target lowering; an [ai] block in
bock.project is the opt-in seam where the compiler may consult an AI
model at capability gaps, with deterministic fallback and pinned replay
in production builds. This path is configured but not yet exercised in
real-world usage; Bock uses rule-based code generation by default.
Additional codegen targets (Java, C++, C#, Swift) are roadmap candidates
for after v1, not v1 commitments.
A small Bock sample
A function declares its effects in the signature. Here prepare says it
uses Logger; the handler is injected at the call site rather than
imported as a global. The body is a pipeline.
module main
public record Document {
text: String
quality: Float
}
public effect Logger {
fn log(message: String) -> Void
}
public fn normalize(doc: Document) -> Document {
Document { text: doc.text.trim().to_lower(), quality: doc.quality }
}
public fn keep_quality(docs: List[Document]) -> List[Document] {
docs.filter((d) => d.quality > 0.5)
}
public fn prepare(docs: List[Document]) -> List[Document] with Logger {
log("preparing ${docs.length()} documents")
docs
|> keep_quality
|> ((ds) => ds.map(normalize))
}
Quick start
Bock ships as a single binary. Install with Cargo, or download a pre-built binary from GitHub Releases.
Scaffold a project, then check, build, and run it:
bock new generates bock.project (TOML), a src/main.bock entry
point, a tests/ directory, and a .gitignore. The bock.project
includes a commented-out [ai] block; AI-assisted generation is opt-in.
The compiled output runs on its target with nothing from Bock imported at
runtime: node build/js/main.js prints the program's output directly.
The full walkthrough is at bocklang.org/get-started.
Repository layout
| Path | Contents |
|---|---|
compiler/ |
The compiler, a Cargo workspace of bock-* crates plus the bock CLI, and the conformance suite. |
spec/ |
The language specification (spec/bock-spec.md) and its dated changelogs. |
stdlib/ |
The Bock standard library (core.* modules), shipped as source. |
extensions/vscode/ |
The VS Code extension, with vocabulary synced from the compiler. |
examples/ |
Example Bock projects, from fundamentals to real-world shapes. |
docs/ |
The mdBook documentation source. |
website/ |
The bocklang.org marketing site (Astro). |
branding/ |
Brand assets. Most content is gitignored; branding/assets/logo/ is committed for contributor access. |
Documentation
- Website: bocklang.org
- Get started: bocklang.org/get-started
- Documentation:
docs/ - Language specification:
spec/bock-spec.md - Architecture overview:
ARCHITECTURE.md - Roadmap and status:
ROADMAP.md,STATUS.md
Contributing
Bock is at v1.0 and contributions of every size are welcome. Start with
CONTRIBUTING.md for local setup and the workflow, and
ARCHITECTURE.md for a tour of the compiler pipeline.
Participation is governed by the Code of Conduct.
License
Bock is open source under the MIT License.
Community
- Discussions: GitHub Discussions
- GitHub: bock-lang/bock (issues, examples)
- Reddit: r/bocklang
- Web: bocklang.org