Skip to main content

Transpiler Usage

Basic Usage

# Transpile a directory
brikc transpile ./src/ --to rust --output ./dist/

# Transpile with force rebuild (ignore cache)
brikc transpile ./src/ --to python --output ./dist/ --force

# Specify source language (auto-detected by default)
brikc transpile ./src/ --from javascript --to rust --output ./dist/

Options

FlagDescriptionDefault
--to <target>Target language (required)
--output <dir>Output directory./transpiled
--from <lang>Source language (auto-detect)auto
--forceIgnore cache, re-transpile allfalse
--certifyRun Φ_c certificationtrue

Caching

The transpiler caches results. If a source file hasn’t changed since the last transpile, it’s skipped:
⏭ Skipping unchanged: src/utils.js
⏭ Skipping unchanged: src/math.js
✓ src/new-file.js → dist/new-file.rs
Use --force to re-transpile everything.

Parallel Processing

The transpiler uses parallel processing (via rayon) to lift multiple files simultaneously. On a 4-core machine, expect ~4x speedup for large directories.

Error Recovery

If a file fails to lift or build, the transpiler continues with the remaining files:
⚠ src/complex.js — parse error (skipped)
✓ src/utils.js → dist/utils.rs
✓ src/math.js → dist/math.rs

Files: 3 scanned, 2 transpiled, 0 skipped, 1 error

Multi-Target

Transpile the same source to multiple targets:
brikc transpile ./src/ --to rust --output ./dist/rust/
brikc transpile ./src/ --to python --output ./dist/python/
brikc transpile ./src/ --to go --output ./dist/go/

Linking

Combine multiple PCD files into a single output:
# Link PCDs
brikc link ./pcd/ -o linked.pcd

# Bundle into single target file
brikc link ./pcd/ --bundle -t js -o bundle.js