Repository navigation
Zeno 0.5.2
Zeno 0.5.2 adds to what is around the language, and leaves the
language as it was. zeno build --target writes four more languages:
Lua, Ruby, Dart and Kotlin. A package is found by its name, in a
registry. A Zeno program can use the libraries of Python, of
JavaScript and of Java. zeno build --minimal writes the least C that
runs a program. program.run starts another program. Part of the
library is now written in Zeno itself: six new functions of math
and a module random. And a float % that the C++ target got wrong,
and a caught error that could stop a program built on Windows, are
mended.
Each of these is something you ask for. A program that asks for none
of them runs as it did in 0.5.1, at the same speed.
Installing
Windows: download zeno-0.5.2-windows-setup.exe below and run it.
It is not signed, so Windows warns the first time: "More info", then
"Run anyway".
macOS and Linux:
curl -fsSL https://github.com/zeno-src/zeno-lang/releases/download/v0.5.2/install.sh | shBoth put zeno on the PATH and offer to install a C compiler and git
if the machine has none.
docs/install.md
says what they do. The archives further down are for installing by
hand.
Homebrew, on macOS and Linux:
brew tap zeno-src/zeno-lang https://github.com/zeno-src/zeno-lang
brew install zeno-src/zeno-lang/zenoWith another package manager. There is a package for apt, pacman,
snap and flatpak, installed from its file:
sudo apt install ./zeno_0.5.2_amd64.deb # Debian, Ubuntu, Raspberry Pi OS
sudo pacman -U zeno-lang-bin-0.5.2-1-x86_64.pkg.tar.zst # Arch
sudo snap install --classic --dangerous zeno_0.5.2_amd64.snap
flatpak install --user zeno-0.5.2-x86_64.flatpakThe .deb is also there for arm64, armhf (every Raspberry Pi with
a 32-bit system) and i386, the snap for arm64 and armhf, and the
flatpak for aarch64. apt installs a C compiler and git along with
Zeno if the machine has none.
docs/stores.md
says where each manager finds Zeno by itself, with no file, and what is
still to be done for the ones that do not yet.
Four more languages: Lua, Ruby, Dart and Kotlin
$ zeno build --target ruby examples/hello.zeno
Wrote hello.rb. Run it with `ruby hello.rb`
$ ruby hello.rb
Hello, Zeno!
--target |
Writes | Run it with |
|---|---|---|
lua |
hello.lua |
lua hello.lua (Lua 5.4) |
ruby |
hello.rb |
ruby hello.rb (Ruby 3.0 or later, no gem needed) |
dart |
hello.dart |
dart run hello.dart (Dart 3 or later) |
kotlin |
hello.kt |
kotlinc hello.kt -include-runtime -d hello.jar && java -jar hello.jar |
With the eleven of 0.5 that is fifteen. As before, each is one file
with nothing to install beside the language itself, written by fixed
rules, and it does what zeno run does: the same digits of a float,
the same error at the same line, an overflow that is an error.
tools/targets.py holds all fifteen to that on 340 programs.
Two things to know. Lua has a clock in whole seconds and no sleep
unless LuaSocket is installed. And Kotlin takes about ten seconds to
compile any program, because kotlinc compiles Zeno's rules with it
each time.
docs/targets.md
shows what each language's file looks like (decisions 24.30 to 24.34).
A registry: a package by its name
A zeno.package had to say where a package is. Now it can say only
what it is called:
needs units at "v1.2.0"
The registry is a git repository,
zeno-src/packages, with one
small file for each package. There is no server and no account to
make. It is new, and it has no package in it yet.
zeno fetchasks the registry which repository and which commit
unitsatv1.2.0is, and pins it inzeno.lockas before.zeno search wordslists the packages that have those words in
their name or theiraboutline.zeno publishchecks a package, changes nothing, and gives the
address of a form on GitHub that asks the registry to take it. The
first to publish a name owns it, and a published version stays what
it was.zeno registry acceptandzeno registry indexare the registry's
own side, for somebody who keeps one. Aregistry "address"line in
azeno.packagenames another registry than Zeno's.
The two older lines, needs filters in "../filters" and needs units from "address" at "v1.2.0", work as they did.
docs/registry.md
is the walkthrough, and decisions chapter 27 has the reasons.
The libraries of Python, JavaScript and Java
import python
let statistics = python.module("statistics")
print(statistics.mean([21.5, 22.0, 23.5, 22.5]))
import python uses the Python that is on the computer, and any
package pip installed for it. import node does the same with Node
and the packages of npm, and import java with the classes of Java
and any jar. From there the program is written as it would be in that
language: a dot for what a module has, brackets for a call.
| Import | Gives | Needs |
|---|---|---|
python |
python.module(name), python.copy(value) |
Python 3 |
node |
node.module(name), node.global(name), node.new(Class, ...), node.copy(value) |
Node (tried with 22 and 24) |
java |
java.type(name), java.jar(path), java.copy(value) |
Java 11 or later |
The other language is started the first time it is called, and stays
until the program ends. A program without the import starts nothing
and runs exactly as before.
What is not there yet, for all three:
zeno runandzeno testonly.zeno build, in every form,
refuses a program that imports one of them, and says so.- A function of Zeno cannot be given to the other language, so a
library that calls back cannot call into Zeno. Zeno says so at the
line. - Used on Linux; on macOS and Windows only tested. The tests of
all three pass on GitHub's macOS and Windows machines, which have
Python, Node and Java. Beyond those tests, nothing has used them
there yet.
docs/python.md,
docs/node.md
and
docs/java.md
are the walkthroughs; decisions chapters 26, 28 and 29 the reasons.
examples/video.zeno, checksum.zeno and zipped.zeno each use one.
zeno build --minimal: the least C
zeno build writes C that keeps every promise Zeno makes: an index is
checked, a sum is checked for overflow, an error says its line, and
the whole runtime is written in front of the program. For
examples/hello.zeno that is 3,028 lines of C.
zeno build --minimal examples/hello.zeno # 23 lines of C--minimal writes the least C that runs the program, close to what a
person would write by hand: no checks, only the parts of the runtime
the program uses, print as printf, and -Os. It is for a program
that is already correct. A mistake in it does what it would do in C.
It goes with --owned, --no-collector, --firmware, --memory and
--fast. Without the option, zeno build writes the C it wrote in
0.5.1, but for the few lines about try on Windows under "Mended".
tools/minimal.py builds 365 programs both ways and compares what
they print.
docs/minimal.md
has the table of what is given up and how much smaller a program
gets; decisions chapter 30 the reasons.
program.run: start another program
import program
let ended = program.run("git", ["status", "--short"])
It starts the program, gives it the words of the list as they are
(there is no shell between), waits, and gives the number it ended
with. A program that cannot be started is a FileError.
examples/download.zeno saves a video with yt-dlp this way. zeno run and zeno test have it; a built program does not yet, and the
build says so
(docs/running-programs.md,
decisions chapter 25).
A library written in Zeno: more of math, and random
import math
import random
let reading = 512 + random.between(-40, 40)
print(math.clamp(reading, 0, 1023), math.hypot(3.0, 4.0), math.gcd(48, 18))
540 5.0 6
math has six more functions: hypot, sinh, cosh, tanh,
gcd and clamp. random is a new module: seed, number,
between and pick. Both are written in Zeno, in files kept inside
the zeno program, so every engine, every build and every target
runs the same code, and none of them needed a line of its own.
A file of the library is read only when a program imports the module
and spells one of its names; a program that does not is read as it
was in 0.5.1.
Things to know:
randomgives the same numbers on every run until
random.seed(n)is called. Nothing is taken from the machine's
clock, so a test that uses it always sees the same thing.randomis now the name of a module that comes with Zeno, so a
program's ownrandom.zenocan no longer be imported by that name.math.hypottakes floats (hypot(3.0, 4.0)), and for very large
or very small sides it can differ from C'shypotin the last
digit.sinh,coshandtanhshare the last digit ofexp.random.between(low, high)needshigh - lowto fit in an int.
examples/noise.zeno uses both.
docs/library-in-zeno.md
shows how it is built, and decisions chapter 33 the reasons.
Mended
--target cpp: a float%could be wrong in its last digits.
The remainder is worked out as a product and then a difference. A C++
compiler may do both in one step that rounds once (g++ 15 does, and
clang on ARM64), and then7.0 % 0.1gave-3.885780586188048e-16
wherezeno rungives0.0. The written file now tells the compiler
to keep them two steps, as the C ofzeno buildalways did, and the
Go target does the same. 0.5.0 and 0.5.1 have the mistake (decision
24.35).zeno buildon Windows: a caught error could stop the program.
With MinGW, C'slongjmpdoes more than jump: it walks the stack as
for an exception of C++. Built by gcc 15 with-Os, which is what
--minimalasks for, that walk stopped a program at its first caught
error, and nothing was said. Atryis now a plain jump there, as it
is on Linux and macOS and in a build with--llvm. It was not seen
in a build without--minimal, but nothing made those safe from it
(decision 32.1).- Two files of one program may both
import math. The second
was refused before, as a name declared twice. zeno build: a function of an imported file used as a value.
The C did not compile.zeno build: a field with the name of a class or an enum. The C
compiler refused the C that was written for it (decision 31.1).- The weekly check of the targets on GitHub reported success with a
failed program in its report. It fails now when a program differs.
As fast as 0.5.1
All of the above is code that runs only when it is asked for, and this
release was held to that. Each benchmark was run with 0.5.1 and with
0.5.2 on one machine, counted in instructions and timed in alternating
rounds.
Programs built with zeno build, in every form (--release,
--owned, --fast), run exactly the instructions they ran in 0.5.1:
their C differs only in the lines for Windows. Both engines of zeno run run fewer than in 0.5.1. Counted in millions of instructions:
zeno run --vm 0.5.1 |
0.5.2 | zeno run 0.5.1 |
0.5.2 | |||
|---|---|---|---|---|---|---|
| fib | 3,173 | 3,146 | −0.8 % | 12,837 | 12,786 | −0.4 % |
| loop | 21,461 | 21,081 | −1.8 % | |||
| sort | 12,357 | 12,213 | −1.2 % | 49,511 | 49,352 | −0.3 % |
| strings | 4,339 | 4,310 | −0.7 % | |||
| trees | 21,257 | 21,111 | −0.7 % | 50,919 | 50,745 | −0.3 % |
| nbody | 40,588 | 40,469 | −0.3 % |
(The empty places in the last columns take too long under the
counting tool to be worth it; the timings below cover them.)
Timed, in seconds, the best of five to ten rounds, the two versions
run in turn:
zeno run --vm 0.5.1 |
0.5.2 | zeno run 0.5.1 |
0.5.2 | |
|---|---|---|---|---|
| fib | 0.79 | 0.79 | 3.13 | 3.12 |
| loop | 8.75 | 8.19 | 35.94 | 36.23 |
| sort | 4.18 | 4.14 | 15.59 | 15.77 |
| strings | 1.80 | 1.78 | 3.47 | 3.35 |
| trees | 10.03 | 9.89 | 25.24 | 25.17 |
| nbody | 17.26 | 16.81 | 57.42 | 57.29 |
A difference of one or two in a hundred either way is the machine,
not Zeno: the same two programs, timed again, move that much. Where
one run looked a few percent slower (trees and nbody), it was
timed again with more rounds, and the figures above are those.
The archives
| Machine | File |
|---|---|
| Linux, x86-64: most PCs and servers | zeno-0.5.2-linux-x86_64.tar.gz |
| Linux, ARM64: a Raspberry Pi 3, 4 or 5 with a 64-bit system, ARM servers | zeno-0.5.2-linux-arm64.tar.gz |
| Linux, 32-bit ARMv7: a Raspberry Pi 2 or later with a 32-bit system | zeno-0.5.2-linux-armv7.tar.gz |
| Linux, 32-bit ARMv6: a Raspberry Pi 1 or Zero | zeno-0.5.2-linux-armv6.tar.gz |
| Linux, 32-bit x86 | zeno-0.5.2-linux-x86.tar.gz |
| macOS, Apple silicon | zeno-0.5.2-macos-arm64.tar.gz |
| macOS, Intel | zeno-0.5.2-macos-x86_64.tar.gz |
| Windows, x86-64 | zeno-0.5.2-windows-x86_64.zip |
| Windows, 32-bit x86 | zeno-0.5.2-windows-x86.zip |
| Windows, ARM64 | zeno-0.5.2-windows-arm64.zip |
Unpack it and put zeno (zeno.exe on Windows) somewhere on your
PATH. To build web pages, put zeno.wasm from the same folder
beside it. The folder also holds the docs, the examples and the editor
setup.
tar -xzf zeno-0.5.2-linux-x86_64.tar.gz
cd zeno-0.5.2-linux-x86_64
./zeno --version
./zeno build --release examples/hello.zeno && ./hello
./zeno build --target py examples/hello.zeno && python3 hello.pyOn macOS, a program downloaded with a browser is held back because
Apple has not signed it. xattr -d com.apple.quarantine zeno lets it
run.
zeno build hands the C it writes to a C compiler, so it needs one:
cc, gcc or clang, whichever it finds first, or the one CC
names. zeno build --llvm needs clang. zeno fetch, zeno search
and zeno publish need git. zeno build --target needs nothing to
write the file (but wasm, which needs Rust), and the language to run
it. import python, import node and import java need that
language. zeno build --web and everything else need nothing.
What was checked
As for 0.5.1, every build but the Windows one for ARM64 was run before
it was released, and each one that was run also built the page of
examples/todo.zeno and wrote examples/hello.zeno in fourteen
languages. The whole test suite, 570 tests, passes on Linux
x86-64, on macOS on Apple silicon and on Windows x86-64.
The fifteen targets were checked on Linux x86-64, on GitHub's machine,
with the newest Node, TypeScript, Python, PHP, Lua, Ruby, Dart,
Kotlin, Go, Java, .NET, g++ and Rust: 340 of 340 programs each, and
331 of 331 for the page, which is opened in Chromium. --minimal was
checked there and on macOS on 365 programs.
The speed was compared with 0.5.1 on one machine, Linux on x86-64,
counted and timed. The builds for the other systems are made the same
way but were not timed.
The setup program for Windows was installed, run and uninstalled on a
Windows machine, and install.sh the same on Linux and on macOS. Each
package was installed, run and removed: the .deb, the snap and the
flatpak on Ubuntu, the pacman package in Arch, and the Homebrew
formula on macOS.