#Getting Started
#Prerequisites
Zenth compiles to native binaries through Go, so you need:
#Installation
Clone the repository and build the compiler:
git clone https://github.com/mkaz/zenth.git
cd zenth
just buildThis produces a zenth binary in the current directory. To install it to your $GOPATH/bin:
just install#Your First Program
Create a file called hello.zn:
fn main() {
Println("Hello, World!");
}Every Zenth program needs a main function as its entry point.
#Building and Running
Compile and run in one step:
zenth run hello.znCompile to a binary:
zenth build hello.zn
./helloSpecify an output name:
zenth build -o greet hello.zn
./greetView the generated Go source (useful for debugging):
zenth build --emit-go hello.zn#File Extension
Zenth source files use the .zn extension.
#A Slightly Bigger Example
Here’s a Fibonacci program that shows functions, loops, and type annotations:
fn fibonacci(n: Int) -> Int {
if n <= 1 {
return n;
}
return fibonacci(n - 1) + fibonacci(n - 2);
}
fn main() {
for var i = 0; i < 15; i++ {
Println(fibonacci(i));
}
}zenth run fibonacci.zn