A general-purpose programming language with that aspires to have support for attribute grammars, managed effects, and efficient pure functional programming.
Miscellaneous links:
Note: This is a super-preliminary release; expect tons of stuff to be broken!
Currently, the best way to try Sylvan is via our dev
container image.
You can download or update it by running:
$ docker pull oci.sylvan-lang.org/dev:0.0.1
0.0.1: Pulling from dev
[...]
Status: Downloaded newer image for oci.sylvan-lang.org/dev:0.0.1
oci.sylvan-lang.org/dev:0.0.1
(This is an OCI image, and so should work with any other container runtime, e.g. Buildah or Podman.)
You can create a container, mount the current working directory to /code
inside it, and run commands inside it with:
Inside the dev
container, source files and libraries will be searched for inside of /code
. /code
is also the default working directory.
Letʼs try making and running a “Hello, world” program. Create a file in /code
named hello_world.syl
.
Here, we use the Neovim text editor, which is installed and configured inside the dev
container to support editing Sylvan code. If you prefer a different text editor, it can be installed with apt
. Otherwise, since the /code
directory is mounted from the host, you can use a text editor on the host machine.
Write the following code into the file, then save and exit:
pub def main() -{ OS }> () {
perform(OS::Print("Hello, world!\n"))
}
We can load the standard library and our code to check both for errors and then run the hello_world::main
function by passing them to the sylvan
binary on the command line.
# sylvan std hello_world -- hello_world
Hello, world!
OS
effect) to get a self-contained binary for another platform.aarch64-darwin
(binaries, Nix)aarch64-linux
(binaries, containers, Nix)riscv64-linux
(binaries, containers)x86_64-linux
(binaries, containers, Nix)Browser
effect, with basic Web APIs.always_inline
.riscv64-linux
aarch64-linux
core
library that tightly integrates with the compiler and a std
library that can be separately versioned.aarch64-darwin
x86_64_apx-linux
wgsl-webgpu
aarch64-none
riscv64-none
nvptx64-cuda
// This is the attribute grammars example.
// TODO: Examples go here. Maybe the examples should
// be something like:
//
// - regex isNullable check using AGs
// - paradelle checker?
// - adding tracing to existing code with an effect
// handler?
// - show that something like quicksort with mutation
// isn't hard to write; also, you get the machine
// code you want at the end?
// This is the functional features example.
// TODO: Examples go here. Maybe the examples should
// be something like:
//
// - regex isNullable check using AGs
// - paradelle checker?
// - adding tracing to existing code with an effect
// handler?
// - show that something like quicksort with mutation
// isn't hard to write; also, you get the machine
// code you want at the end?
// This is the managed effects example.
// TODO: Examples go here. Maybe the examples should
// be something like:
//
// - regex isNullable check using AGs
// - paradelle checker?
// - adding tracing to existing code with an effect
// handler?
// - show that something like quicksort with mutation
// isn't hard to write; also, you get the machine
// code you want at the end?