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
(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:
docker run --rm -itv "$(pwd):/code" \
oci.sylvan-lang.org/dev:0.0.1
sylvan --help
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.
nvim 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.
Since the /code directory is mounted from the host, you can also use a text editor on the host machine.
Write the following code into the file, then save and exit:
pub def main() -{ OS }> () {
println("Hello, world!");
}
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
At this point, you’ve seen how to get the Sylvan compiler, what a simple program looks like, and how to run it.
Documentation has not yet been written for the full Sylvan language or standard library, so at this point the best thing to do to learn more might be to poke around the src directory in the repo.