#Getting Started

#Prerequisites

Zenth compiles to native binaries through Go, so you need:

  • Go 1.26 or later
  • just command runner (optional, for convenience)

#Installation

Clone the repository and build the compiler:

git clone https://github.com/mkaz/zenth.git
cd zenth
just build

This 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.zn

Compile to a binary:

zenth build hello.zn
./hello

Specify an output name:

zenth build -o greet hello.zn
./greet

View 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

#Next Steps

  • Variables — learn about let, var, and const
  • Functions — parameters, return types, and calling
  • Strings — interpolation and raw strings