Repository navigation
Zeno 0.5.0
Zeno 0.5 writes your program in another language. zeno build --target <language> gives a file in JavaScript, TypeScript, Python,
PHP, Go, Java, C#, C++ or Rust, a web page, or a WebAssembly file, that
prints what zeno run prints. Nothing else about Zeno moves: zeno run and zeno build are as fast as in 0.4.
Installing
Windows: download zeno-0.5.0-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/partham20/zeno-lang/releases/download/v0.5.0/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 partham20/zeno-lang https://github.com/partham20/zeno-lang
brew install partham20/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.0_amd64.deb # Debian, Ubuntu, Raspberry Pi OS
sudo pacman -U zeno-lang-bin-0.5.0-1-x86_64.pkg.tar.zst # Arch
sudo snap install --classic --dangerous zeno_0.5.0_amd64.snap
flatpak install --user zeno-0.5.0-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.
zeno build --target: the program in another language
$ zeno build --target py examples/hello.zeno
Wrote hello.py. Run it with `python3 hello.py`
$ python3 hello.py
Hello, Zeno!
--target |
Writes | Run it with |
|---|---|---|
js |
hello.js |
node hello.js |
ts |
hello.ts, TypeScript |
node hello.ts (Node 22.18 or later), or tsc, Bun, Deno |
html |
hello.html, a page that runs the program |
a browser |
py |
hello.py |
python3 hello.py |
php |
hello.php |
php hello.php (PHP 8.0 or later, no extension needed) |
go |
hello.go |
go run hello.go |
java |
hello.java |
java hello.java (JDK 11 or later) |
cs |
hello.cs |
dotnet run hello.cs (.NET 10 or later) |
cpp |
hello.cpp |
g++ -std=c++17 -O2 hello.cpp -o hello && ./hello |
rust |
hello.rs |
rustc -O --edition 2021 hello.rs -o hello && ./hello |
wasm |
hello.wasm, built by rustc |
wasmtime hello.wasm, or any WebAssembly host with WASI |
It is one file, with nothing to install beside the language itself.
The file is written by fixed rules: the same program gives the same
file, letter for letter.
It does what zeno run does. The file carries Zeno's rules with
it, so a whole number that overflows is an error in the Python and the
JavaScript too, a float prints with the same digits, a list index out
of range stops the program with the same message at the same line, and
text in Tamil is counted and cut the same way. A tool holds every
target to that: tools/targets.py runs 337 programs (every example,
every sample of the book, and 22 written to try the corners) with
zeno run and in each language, and compares what is printed and the
error a program stops with. All eleven targets print the same on all of
them.
It is only a flag. Without --target, nothing of this runs. zeno run, zeno build, --release, --fast and --web do what they did
in 0.4, at the same speed. The C that zeno build writes for the six
benchmarks is the C that 0.4.0 wrote, but for one function that quotes
a text, and the built programs run the same count of instructions, to
one part in ten thousand, on five of the six. On the sixth, nbody, the
two builds with --owned run half a percent more (three or four
instructions a step), because the C compiler placed the same loop at
another address. zeno run --vm, whose code was not touched, is within
about two in a hundred either way (fewer on loop and nbody, more on fib
and trees), which is the Rust compiler laying the same code out
differently.
What it cannot write. A program for a board (import board), a
page made with import web, and unsafe memory belong to zeno build; --target says so and writes nothing.
docs/targets.md
shows what each language's file looks like, how it is made, how fast
it is, and its known limits.
One rule where there were two
Writing eleven other ways to run a program showed where zeno run did
whatever the Rust it is built with does. Each such corner now has a
rule, which zeno run, zeno build and every target keep. A program
only sees a difference from 0.4 in these corners:
- Text in quotes. A text shown inside a list or a dict, or named in
an error, is written as it is.["தமிழ்"]printed as
["தமிழ\u{bcd}"]; now it prints as written. Only control
characters are shown as codes (decision 24.20). - A float exactly between two shortest texts prints the one whose
last digit is even, aszeno buildalready did. It can only happen
to a float of 16 or 17 digits (24.21). lines()andinput(). A\rbelongs to the end of a line
only just before the\n, whatever version of Rust built Zeno
(24.24).
Mended
rangewith a step that goes past the last int ended in a wrong,
endless list. It ends the range.json.parsetook\u+041as a character. The four after\umust
be hex digits, and the second half of a pair must be one.
The archives
| Machine | File |
|---|---|
| Linux, x86-64: most PCs and servers | zeno-0.5.0-linux-x86_64.tar.gz |
| Linux, ARM64: a Raspberry Pi 3, 4 or 5 with a 64-bit system, ARM servers | zeno-0.5.0-linux-arm64.tar.gz |
| Linux, 32-bit ARMv7: a Raspberry Pi 2 or later with a 32-bit system | zeno-0.5.0-linux-armv7.tar.gz |
| Linux, 32-bit ARMv6: a Raspberry Pi 1 or Zero | zeno-0.5.0-linux-armv6.tar.gz |
| Linux, 32-bit x86 | zeno-0.5.0-linux-x86.tar.gz |
| macOS, Apple silicon | zeno-0.5.0-macos-arm64.tar.gz |
| macOS, Intel | zeno-0.5.0-macos-x86_64.tar.gz |
| Windows, x86-64 | zeno-0.5.0-windows-x86_64.zip |
| Windows, 32-bit x86 | zeno-0.5.0-windows-x86.zip |
| Windows, ARM64 | zeno-0.5.0-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.0-linux-x86_64.tar.gz
cd zeno-0.5.0-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 needs git. zeno build --target needs nothing to write the file (but wasm, which
needs Rust), and the language to run it. zeno build --web and
everything else need nothing.
What was checked
As for 0.4.0, 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 ten languages. The whole test suite, 519 tests, passes on Linux
x86-64, on macOS on Apple silicon and on Windows x86-64.
The eleven targets were checked on Linux x86-64, on GitHub's machine,
with the newest Node, TypeScript, Python, PHP, Go, Java, .NET, g++ and
Rust: 337 of 337 programs each, and 328 of 328 for the page, which is
opened in Chromium. The file written is the same on every system, but
it was run on Linux only.
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.
The speed of 0.5.0 was compared with 0.4.0 on one machine, Linux on
x86-64, by counting instructions (bench/run.py --count).