v0.4.5

A small native language
that uses C code as it is.

Zevic turns source code into LLVM IR and lets clang produce the machine code. Types are always written, failures come back as a Result, and a GC manages memory. The compiler is written in Zevic itself.

module Main

import Zevic.Console

fn FizzBuzz(n: I32) -> String {
    if (n % 15 == 0) {
        "FizzBuzz"
    } else if (n % 3 == 0) {
        "Fizz"
    } else if (n % 5 == 0) {
        "Buzz"
    } else {
        "${n}"
    }
}

fn Main() {
    for (i in 1..=20) {
        Console.Println(FizzBuzz(i))
    }
}

Compile and run

zevic fizzbuzz.zev -o fizzbuzz
./fizzbuzz

if and match are expressions that return values, and the last expression is the function's result. There are no exceptions and no null. Continue with the tutorial.

Features

  • Uses C as it isCall C functions with extern "C" and expose Zevic functions to C with export "C". C sources build together with Zevic.
  • Self-hostedThe compiler zevic1 is written in Zevic and builds itself to the same LLVM IR (make bootstrap).
  • Failures are typesOption and Result, and the ? operator. No exceptions, no null.
  • Expressive typesstruct / class / enum / interface, generics, closures and union types A | B.
  • Concurrencyasync / await, channels, OS threads (Thread.Spawn) and arbitrary-precision BigInt.
  • Standard libraryFs Json Http Net Regex Csv Toml DateTime Zip Cli and more: over 30 modules.
  • Toolszevpm for packages and builds, zevfmt for formatting, and test blocks for testing.
  • Garbage collectedThe Boehm GC is bundled, so you can write code without thinking about memory management.