Zydeco is a proof-of-concept programming language based on Call-by-push-value.
The instructions are located in lib/tests/oopsla/README.md.
- DESIGN.md: language model and implementation architecture
- CONTRIBUTE.md: build, test, and development workflows
Create a file hello-world.zy in the repository root:
param (
(/system) :
@[import("lib/std/builtin.zy")] _
) in
let (/stdio; /process) = system in
! (stdio/write_line) "hello, world!" { ! (process/exit) 0 }
Then run
cargo run -- run hello-world.zy
hello, world!Alternatively, run
cargo build --releaseto build the executable which will be stored at target/release/zydeco.
Then run
./target/release/zydeco run hello-world.zydecoand see
hello, world!Run zydeco --help for further usage information.
Start the full-screen terminal REPL with:
zydeco replEach submitted term receives an input number such as [1].
A later term can hygienically splice that source with @[import(1)] _; the integer is deliberately unquoted,
because @[import("1")] _ denotes a file named 1.
The REPL uses root metadata annotations for its commands:
@[type] ret 1
@[run] ret 1
@[help] _
@[quit] _
Press Enter to evaluate complete syntax or continue an incomplete term on a new line. Alt+Enter always inserts a newline, and Ctrl+Enter submits the current text for diagnostics. A type checking error leaves the editor and input number unchanged so the source can be corrected and retried.
For a complete source-level guide, see docs/tutorial/zydeco-guide.md.
We now have a toy "literate zydeco" written in zydeco! Try it out by running
cd docs/spell && make buildand the product will show up right in the folder - which is also a series of guide to programming in zydeco. Maybe we should call it "co-literate zydeco" because it turns commented zydeco into markdown.
A legacy version of the tutorial lies here.
You might find the short tutorial easier to follow if the previous spell guide goes too fast.
We will develop more introductory material on zydeco when we have implemented more features.
For now, you can also choose to browse lib/ for some example programs.
To run all tests
cargo test-allThe cajun binary is Zydeco's Language Server Protocol implementation.
It provides live syntax and name-resolution diagnostics, document symbols, and go to definition across imported files:
cargo install --path editor/cajunClient integrations live under editor/vscode and editor/zed.
To generate documentation for a package:
cargo doc --package zydeco-statics --no-depsThe output is written to target/doc/.
.
βββ Cargo.toml
βββ lang
β βββ derive
β βββ syntax
β βββ surface
β βββ statics
β βββ session
β βββ dynamics
β βββ stackir
β βββ assembly
β βββ amd64
β βββ llvm
β βββ tests
β βββ utils
βββ cli
βββ tui
βββ web
βββ ...
lang/: the library implementing the parser, type checker and interpreter for the Zydeco language.lib/: standard library, reusable examples, andlib/tests/regression projectscli/Command-line interfacetui/Ratatui frontend for the interactive REPLweb/Web interface
Zydeco is based on the Call-by-push-value calculus introduced by Paul Blain Levy: https://dl.acm.org/doi/10.1145/3537668.3537670