Zinc is a research programming language that compiles to Rust. It combines Go-like concurrency primitives with dynamic typing, type inference, and object-oriented programming through structs. It is highly experimental and not intended for production use. It is primarily a playground for exploring language design and hopefully a source of ideas for other languages.
- Compiles to Rust - Leverages Rust's performance, safety, and ecosystem
- Go-style Concurrency - Channels and
spawnfor easy concurrent programming - Python-style Dynamic Typing - Variables can be reassigned to different types
- Strict Type Annotations - Any written type annotation is enforced at compile time
- Type Inference - No explicit type annotations required
- Monomorphization - Generic functions are specialized at compile time
- Rich Compile-Time Metadata - Object-oriented programming with static and instance methods
# Compile to Rust
python -m zinc.main compile program.zn -o output.rs
# Print the AST
python -m zinc.main tree program.zn
# Syntax check only
python -m zinc.main check program.znGenerated Rust that uses Zinc runtime features (channels, contexts, or compile-time metadata) must be built in a Cargo project with the internal runtime crate enabled for the features the compiler reports:
zinc-internal = { path = ".../rust_runtime/zinc-internal", default-features = false, features = ["channel"] }see ROADMAP.md
See Why Zinc? for a high level overview of the language design and philosophy.
See USER_GUIDE.md for a basic tutorial and language reference.
The zinc-lang VSCode extension provides syntax highlighting. It is not available on the marketplace yet, but you can build and install it locally
npm install -g @vscode/vsce
cd extension/zinc-lang
vsce package --allow-missing-repository --skip-license && code --install-extension zinc-lang-0.0.1.vsixdocker run -it -v /Users/eric/code/zinc/zinc/parser:/workspace zinc-dev /regenIf you use the vscode devcontainer, you may just run the regen command directly in the terminal.
uv run pytest -n autoTo regenerate rust source
uv run python test/test_compile.py --update-output