Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Building from Source

Prebuilt binaries

Each tagged release of cambrian-lang publishes the cambrian-transpiler CLI on the Releases page for Linux (x86_64, aarch64), macOS (arm64, x86_64) and Windows (x86_64). Download cambrian-transpiler-<version>-<platform>.tar.gz (.zip on Windows), unpack it, and put cambrian-transpiler on your PATH. The sample contracts used in this book are in the repository, not in the archive.

Build

Clone the repository and build the transpiler from its root:

git clone https://github.com/Ordocode/cambrian-lang.git
cd cambrian-lang
cargo build --release -p cambrian-transpiler

(cargo build --release builds the whole workspace, including the transpiler.)

The binary is:

target/release/cambrian-transpiler

Optionally put it on your PATH:

ln -s "$(pwd)/target/release/cambrian-transpiler" ~/.local/bin/cambrian-transpiler

Invoke it as ./target/release/cambrian-transpiler from the repo, or as cambrian-transpiler once it is on PATH. The examples below assume the binary is on PATH.

CLI usage

cambrian-transpiler <input.cam> [-o <output_dir>] [--target evm|lean]
                    [--dump-ast] [--check-lean] [--check]
                    [--diagnostic-format human|json] [--max-errors N]

cambrian-transpiler --project <project.yaml> [--check] [--check-lean]

cambrian-transpiler --version [--json]
FlagMeaning
-o <dir>Write generated files under <dir>. Default: build/<entity_name>-entity/ (snake_case, e.g. build/counter-entity/).
--target <name>Backend: evm (default) or lean.
--project <yaml>Load a multi-file project from project.yaml (sources, optional library_paths / imports, target, output dir). The output dir and target come from the YAML; -o / --target are ignored with a warning.
--checkParse, validate and check target compatibility; write nothing.
--dump-astPretty-print the parsed program and exit (no codegen).
--check-leanAfter --target lean, run lake build in the output directory.
--diagnostic-format <fmt>human (default) or json diagnostics.
--max-errors <N>Cap recovered parse diagnostics (default 32).
--versionPrint the compiler build identity (--json for machine-readable output).

Targets at a glance

--targetOutput
evm (default)Flat Solidity under src/, plus Foundry harness when tests are present
leanLean 4 + Lake project

Examples:

# EVM Solidity (default)
cambrian-transpiler contracts/counter.cam -o /tmp/counter-evm --target evm

# Lean 4 project (optionally verify with lake)
cambrian-transpiler contracts/counter.cam -o /tmp/counter-lean --target lean --check-lean

# Multi-file project
cambrian-transpiler --project path/to/project.yaml

# Inspect parse result only
cambrian-transpiler contracts/counter.cam --dump-ast

Workspace tests

From the same repository root:

cargo test --workspace

Next steps

Continue to the Quick Start.