Code that reads like what it means.

Zeno is a programming language for a quick script and for a microcontroller. Keywords are whole words, punctuation stays only where it helps, and every program is checked before it runs.

Checked before it runs Builds with no heap Four engines
if (!not ready &&and (retries > 3 ||or timed_out)) {
    throw new raise Timeout("gave up");
} else if (count != 0) {
    print("retrying");
}

Two rules shape every line.

Most languages inherit their punctuation. Zeno asks each mark what it tells the reader, keeps the ones everyone already reads, and turns the rest into words.

Kept, because it helps

{ }
You always see where a block ends, and a stray space cannot change what the code does.
( ) [ ] ,
Calls, lists and items. Everyone already reads these.
: ->
A name is set apart from its type at a glance.
#
A comment. One character, hard to miss.
& | ^ << >>
Bit operators, written the way every datasheet writes a register.

Dropped, because it repeats

;
The line break already ends the statement.
&& || !
and, or and not say it in words.
( ) around a condition
if x > 0 { needs no help.
fn => ?
Every keyword is a word you can say aloud: function, match, case.
truthiness
A condition is true or false. An empty list is not quietly false.

Read the reason for every choice

A tour, with the compiler's own answers.

Every sample was run with zeno run. What is printed under it is exactly what Zeno said, error messages included.

Say once if it changes

let is set once, var can change, and a plain = updates. A type goes after the name, and only where you want one.

basics.zeno
let name = "Zeno"            # let: set once
var count = 3                # var: can change
count = count + 1            # plain = updates it
const LIMIT = 10             # const: fixed when the program is built

let ports: list[int] = [80, 443, 8080]   # a type, only where you want one
print(name, count, LIMIT, ports)
output
Zeno 4 10 [80, 443, 8080]

The whole language, a step at a time

Mistakes stop at the checker.

Nothing runs until the whole program makes sense. Each message points at the line and says what to write instead.

  • A misspelt name

    Plain = only updates, so a typo cannot quietly make a new variable.

    cuont = count + 1count = count + 1
  • A forgotten case

    A match must handle every case of the enum.

    no case for Dotcase Dot { return 0.0 }
  • A value that may be missing

    Anything that can be none is checked before it is used.

    user.upper()if user is not none { }
  • A number with no unit

    Milliseconds stay milliseconds, all the way down.

    blink_for(20)blink_for(20 ms)
  • A condition that is not a yes or no

    There is no truthiness to remember.

    if items {if len(items) > 0 {
  • A value used after it was given away

    Ownership is checked, with no garbage collector needed.

    print(frame.channel)send(frame) last

One job, four ways.

A sensor gives five readings. Throw away the ones out of range and average the rest. Zeno does not make you pick a style.

let readings = [21.5, 22.0, -99.0, 21.0, 150.0]
s1.zeno
class Sensor {
    low: float
    high: float

    function average(self, readings: list[float]) -> float {
        var total: float = 0.0
        var count: int = 0
        for reading in readings {
            if self.low <= reading <= self.high {
                total += reading
                count += 1
            }
        }
        return total / count
    }
}

print(Sensor(-40.0, 85.0).average(readings))

All four print 21.5

The same language, on a microcontroller.

Firmware is where Zeno started. This traffic light is a state machine on three pins. On a computer the board is simulated, and each line of the log is what a logic analyser on that pin would show.

signal.zeno, the main loop
function hold(light: Light) -> ms {
    match light {
        case Red { return 40 ms }
        case Green { return 30 ms }
        case Amber { return 10 ms }
    }
}

var light = Red
for step in range(7) {
    show(light)
    led.toggle()                 # a heartbeat: the program is alive
    sleep(hold(light))
    light = after(light)
}
Simulated board, 25 times slower
pin 2 on
led on

The excerpt leaves out show and after. The whole program is examples/signal.zeno.

  • Errors as values

    --firmware turns every error into a return value the caller tests. No setjmp.

  • No garbage collector

    --no-collector leaves it out. Every value has one owner and is freed on a line you can point to.

  • One fixed pool

    No malloc. Lists and objects live in one array whose size you choose.

  • Four C functions to a board

    A compiled program meets real hardware through four functions you write once.

zeno build --no-collector --memory examples/buffer.zeno
memory: 1691 blocks made (2646563 bytes), at most 13336 bytes in use at once, no collector, 0 blocks left at the end
pool: 25384 bytes taken, in a pool of 32768
text: at most 53 bytes in use at once, in a room of 1024

That program makes 2.6 MB of values over its run and never holds more than 13 KB at once.

How the firmware build works

One front end, four engines.

The compiler is plain Rust with no dependencies, so every stage is there to read. The tests run each program on all four engines, and they must print the same.

Memory, three ways

A small collector by default, owned values freed where their owner ends, or no collector at all on a fixed pool.

Every stage is written up

Each part of the compiler has a walkthrough that ends with things to try.

Every decision has a reason

One document records each choice, why it was made, and what was turned down.

Walk through the compiler

One language, every job.

The goal is that anything you would reach for C, C++, Python, JavaScript, Java or Rust to do, you can do in Zeno. This is where that road stands.

  1. ScriptsAn interpreter and a bytecode VM.Works today
  2. FirmwareC with no heap, no collector, memory by hand.Works today
  3. Library and modulesFiles, input, maths, dictionaries, programs in many files.Works today
  4. Version 0.1Packages, tests, a formatter and a language server.Works today

The full roadmap

Run it yourself.

You need Rust to build Zeno, and a C compiler for zeno build. There is nothing else to install.

Terminal
git clone https://github.com/partham20/zeno-lang
cd zeno-lang
cargo build --release
./target/release/zeno run examples/tour.zeno