Getting Started
This guide walks you through installing Zamin from source, verifying your setup, writing your first script, and organizing larger projects.
Prerequisites
Before building Zamin, make sure you have the following installed on your system:
- Rust 1.80+ — Zamin is written in Rust. Install it via rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
- Git — Required to clone the repository.
- C compiler — GCC or Clang on Linux/macOS, MSVC on Windows. Needed for native extensions and optional features.
Installation
Clone and build
Clone the repository and build Zamin in release mode:
git clone https://github.com/young-developer90/zamin.git
cd zamin
cargo build --release
The compiled binary will be at target/release/zamin. Add it to your PATH for convenient access:
export PATH="$PWD/target/release:$PATH"
Optional features
Zamin supports optional feature flags that enable additional capabilities:
cargo build --release --features opencv
| Feature | Description |
|---|---|
opencv | Enable OpenCV bindings for image processing and computer vision |
luna | Enable the Luna GUI toolkit for Linux |
python | Enable Python interop for calling Python libraries directly |
You can combine multiple features:
cargo build --release --features "opencv,luna,python"
Verify Installation
Check that Zamin is installed and working:
$ zamin version
zamin 1.7.3
Launch the interactive REPL to confirm the runtime is functional:
$ zamin repl
Zamin 1.7.3 (interactive)
Type "help" for more information.
zamin>
Your First Script
Create a file called hello.zamin with the following content:
print("Hello, Zamin!")
Run it:
$ zamin run hello.zamin
Hello, Zamin!
Let's try something a bit more interesting. Replace the contents of hello.zamin with:
func greet(name) {
print("Hello, {name}!");
}
func fibonacci(n) {
if n <= 1 {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
greet("World");
for i in 0..10 {
print("fib({i}) = {fibonacci(i)}");
}
Using the REPL
The Zamin REPL is great for experimenting with language features and testing code snippets:
$ zamin repl
Zamin 1.7.3 (interactive)
Type "help" for more information.
zamin> print("Hello!")
Hello!
zamin> 2 + 2
4
zamin> func add(a, b) { a + b }
zamin> add(10, 20)
30
zamin> [1, 2, 3].map(func(x) { x * 2 })
[2, 4, 6]
zamin> .exit
Project Setup
For larger applications, use Zamin's built-in project scaffolding:
$ zamin new myproject
Created new project "myproject"
src/main.zamin
zamin.json
This generates a project directory with the following structure:
myproject/
├── zamin.json
└── src/
└── main.zamin
zamin.json
The zamin.json file defines your project's metadata and build configuration:
{
"name": "myproject",
"version": "1.0.0",
"entry": "src/main.zamin",
"dependencies": [],
"features": []
}
src/main.zamin
The entry point for your application:
print("Welcome to myproject!")
Build and run your project:
$ cd myproject
$ zamin run
Welcome to myproject!
For more details on project management, see the Project CLI reference.