Get started with Bock
Install Bock, write your first function, and build it for your stack.
Install
Bock ships as a single binary for macOS, Linux, and Windows.
Cargo (any platform with Rust installed):
cargo install bock Pre-built binaries: download from GitHub Releases for macOS, Linux, and Windows.
Verify the install:
bock --version Your first project
Scaffold a new project:
bock new hello
cd hello You'll get this layout:
hello/ ├── bock.project ├── .gitignore ├── src/ │ └── main.bock └── tests/
bock.project is the project config (TOML, similar to Cargo.toml or pyproject.toml). It includes a commented-out [ai] block. Bock uses rule-based code generation by default; AI is opt-in. src/main.bock is the entry point. tests/ is where your tests go. The .gitignore is pre-populated with sensible defaults including the .bock/ cache directory that gets created on first build.
Open src/main.bock. The starter prints "Hello, world!":
fn main() {
println("Hello, world!")
} Make it yours.
Build for your target
Bock supports JavaScript, TypeScript, Python, Rust, and Go in v1. The same source compiles to any of them.
JavaScript:
bock build --target js Go:
bock build --target go The JavaScript output uses console.log and ES modules. The Go output uses fmt.Println and follows gofmt conventions. Idiomatic here means the generated code follows each language's conventions rather than mechanically translating Bock's syntax.
Run it
For development, run the source directly through the interpreter:
bock run This skips codegen entirely, which makes the iteration loop fast.
To run the compiled output, build first then invoke the target's runtime:
bock build --target js
node build/js/main.js The compiled JavaScript runs on Node without anything from Bock imported at runtime. The compiled output is your code. Bock isn't in the picture at runtime.
Where to next
The full language reference is at the documentation.
- Language guide: types, effects, context annotations, the strictness system
- Stdlib reference: core modules and what they emit per target
- Examples: examples on GitHub
- Discussions: GitHub Discussions
- Subreddit: the Bock subreddit
Bock is open source under the MIT License.
Back to the homepage when you're ready.
Home