1
0
Fork
You've already forked revo
0
forked from lung/revo
revo, the expressive general-purpose dynamic language
  • Zig 98.6%
  • Python 1.4%
2026年05月18日 21:27:35 +03:00
.github/workflows fix mirror.yml url 2026年05月15日 16:31:22 +03:00
bench lang: pipes now handled parser rather than compiler 2026年05月18日 15:44:43 +03:00
docs mandatory zwanzig run 2026年05月17日 19:34:35 +03:00
examples lang: pipes now handled parser rather than compiler 2026年05月18日 15:44:43 +03:00
scripts vm(fix): std.mem.swap in fiber hotpath 2026年05月18日 09:54:23 +03:00
src std: table:push(...) 2026年05月18日 21:27:35 +03:00
vendor @395fa5d168 squashed ~400 commits 2026年05月07日 13:15:41 +03:00
.gitignore fixup pr 2026年05月13日 19:08:58 +03:00
.gitmodules squashed ~400 commits 2026年05月07日 13:15:41 +03:00
build.zig c header autogen, finally 2026年05月14日 02:24:35 +03:00
build.zig.zon squashed ~400 commits 2026年05月07日 13:15:41 +03:00
CONTRIBUTING.md updated readme and added CONTRIBUTING.md 2026年05月15日 23:53:50 +07:00
LICENSE.txt relicense to MIT, update readme 2026年05月13日 19:27:38 +03:00
README.md Simplify build command in README 2026年05月16日 14:00:28 +07:00
TODO.md vm: callFunction failure does not leak slots 2026年05月13日 07:53:00 +03:00

revo is an expressive, dynamically-typed language that is made to balance semantic freedom and readability

check out the homepage, the basics guide, and the blog

sections

why revo?

revo creates an ergonimic programming experience with:

pattern matching and result types

fn safe_div(a, b)
 if b == 0 (:err, :DivByZero)
 else (:ok, a / b)
match safe_div(10, 2)
 | (:ok, v) print(v) # 5
 | (:err, e) print(e)

fibers

const h = spawn add(20, 22)
join(h) # 42

testing that doesn't hurt

fn add(a, b) a + b
fn mul(a, b) a * b
suite "ops" do
 test "addition" do
 expect(add(20, 22) == 42)?
 expect(add(20, 22) != 22)?
 end
 test "multiplication" do
 expect(mul(20, 22) == 440)?
 expect(mul(20, 22) != 42)?
 end

painless embedding

#include "revo.h"
ErevoVM *vm = erevo_vm_create();
if (!vm) return 1;
ErevoProgram *program = erevo_compile(vm, "main.rv", "1 + 2");
if (!program) {
 puts(erevo_vm_last_error(vm));
 return 1;
}
ErevoData result;
if (!erevo_run(vm, program, &result)) {
 puts(erevo_vm_last_error(vm));
}
if (!erevo_eval(vm, "main.rv", "1 + 2", &result)) {
 puts(erevo_vm_last_error(vm));
}
erevo_program_destroy(program);
erevo_vm_destroy(vm);

you'll enjoy revo so much that you'll want to actually continue a project! so please consider installing revo and giving it a try.

installing

you will need zig 0.16.0 to build revo

on posix systems

git clone https://github.com/if-not-nil/revo && cd revo
zig build -Doptimize=ReleaseFast
cp ./zig-out/bin/revo ~/.local/bin/revo
# verify installation
revo --version

on windows (powershell)

git clone https://github.com/if-not-nil/revo && cd revo
zig build -Doptimize=ReleaseFast
mkdir "C:/tools/revo/bin"
copy ./zig-out/bin/revo C:/tools/revo/bin
# now add it to PATH by doing:
# 1. press Win+S
# 2. type "env" and then press enter. it should take you to the System Properties > Advanced tab
# 3. click "Environment Variables" and then "Path" in the "System variables"
# 4. press "new" and type "C:\tools\revo\bin", then press enter
# 5. press OK for all of the tabs you've opened
# after that, you have to open a new CMD/Powershell window for PATH changes to take effect
# verify installation
revo --version

binary releases are not yet available

usage

usage: revo [options] [script [args...]]
options:
 -e code run code
 -i enter interactive mode after executing
 -d output the last value the program evaluated
 -b compile script to bytecode (.rvo)
 -o path output path for -b (default: input with .rvo extension)
 --test run test blocks
 --bench[n] run with performance counters ([n] iterations, 1 if not specified)
 --dis show bytecode disassembly instead of running
 -h, --help show this help message
 --version show version
examples:
 revo start interactive REPL
 revo script.rv run script
 revo -e "1 + 2" run inline code
 revo -e "1 + 2" -i run inline code and enter REPL
 revo -b script.rv compile script to bytecode
 revo -b -o output.rvo script compile script with custom output path
 revo --bench script.rv run with performance counters
 revo --dis script.rv show bytecode disassembly

development

building

zig build # debug build
zig build run # debug run (repl implementation is hardcoded to a very simple one)
zig build -Doptimize=ReleaseFast # release build
zig build -Drepl=none # custom repl backend (bestline, readline, libedit, none)
# build C library + auto-generated header
# check zig-out/include/, zig-out/lib/
zig build lib 

the default repl backend is the vendored bestline, linked statically. read build.zig

note: the C library and header are only built with zig build lib. the auto-generated header is always in sync with exported functions, marked with callconv("c")

running tests

zig build test --summary all -Dtest_filter="some test name filter"

contributing

recommending to a friend is always greatly appreciated. any contributions are welcome!

see CONTRIBUTING.md for more details

credits

optional repl backends, not vendored but linked dynamically

license

revo is licensed under MIT. see the LICENSE.txt file for details