The Zeno Book Zeno 0.1 zeno-lang.org

E The zeno Command

Everything Zeno does is done by one command, zeno, followed by what to do and usually a file. This appendix lists every command and every option of version 0.1. zeno --help prints the same list.

E.1 Commands

Command What it does
zeno run f.zeno check the program, then run it. Words after the file are the program’s own arguments (Reading and Writing)
zeno check f.zeno check the program for mistakes, and run nothing
zeno build f.zeno compile to C and then to a program that runs by itself (Compiling). The C is kept beside it
zeno test run the test "name" { } blocks of a file, of every file in a folder, or of this folder when nothing is named (Testing)
zeno format f.zeno lay files out the one way Zeno lays them out; several files, or a folder, can be named (The Tools)
zeno new name make a folder with a new program in it: a main.zeno, a module with a test, and a zeno.package (Packages)
zeno new --package name make a folder with a new package: modules for other programs to need, and no main.zeno
zeno fetch get the packages that the needs lines of zeno.package list, for this folder or a named one
zeno tokens f.zeno show the tokens the lexer finds (Inside Zeno)
zeno parse f.zeno show the syntax tree the parser builds, with brackets around every expression
zeno join f.zeno show the one program that the file and every file it imports are joined into
zeno bytecode f.zeno show the bytecode that zeno run --vm runs
zeno lsp the language server. An editor starts it, to show mistakes as you type; you do not run it yourself
zeno --version print the version
zeno --help print the list of commands and options

E.2 Options

An option goes after the command and before the file.

Option With What it does
--strict run, check every type must be known before the program runs, as a build needs (Types, Written and Worked Out). build always works so
--vm run compile to bytecode and run that, in place of walking the tree. Same output, about twice as fast
--no-collector check check as build --no-collector would, without building
--firmware build errors travel as return values, with no setjmp (Firmware)
--no-collector build no garbage collector and no malloc: every list and object has one owner, and memory comes from a fixed pool (Building with No Collector). Turns --firmware on
--llvm build write LLVM IR in place of C and hand it to clang. Goes with the three options around it
--memory build the program reports, as it ends, how much memory it used (Memory)
--check format change nothing; name the files that are not laid out, and fail if there are any
--package new make a package, not a program
--update fetch look every version up again, and not at the commits that zeno.lock pinned

E.3 What a command answers

Every command ends with an exit status, the number a shell script or a build tool reads to know how it went: 0 when all went well, and 1 when the program had a mistake, an uncaught error, a failing test, or a file that format --check would change. Messages go to the error stream, and what the program prints goes to the output stream, so zeno run f.zeno > out.txt keeps only what the program printed.

E.4 Telling the C compiler

A build writes C, and two names can be set when that C is compiled, with -D on the cc or clang line:

Name What it sets
ZENO_BOARD a header that puts a real board under the program, in place of the simulated one: -DZENO_BOARD='"my_board.h"' (Firmware)
ZENO_POOL the size of the pool in bytes for a build with no collector, 32 768 unless set: -DZENO_POOL=25384
ZENO_TEXT_ROOM the size of the text room in bytes, for the same build