Skip to content

moss-lang/moss

Repository files navigation

Moss

An experimental programming language, exploring new ways to manage context.

Caution

This project is still in its very early stages, and is extremely unstable.

Setup

First you must clone this Git repository; any commands listed below should be run in that clone.

If you use direnv and have Nix with flakes enabled, the easiest way to get all necessary dependencies is via the dev shell provided in this repo:

echo use flake > .envrc && direnv allow

The dev shell also puts a moss script on your PATH which wraps the compiler, rebuilding it if it is ever out of date.

If you don't use Nix, the only thing you need for the compiler itself is Rust. You won't be able to use shebangs unless you also have Python installed and manually put the bin directory of this repo on your PATH. Instead, in any example below you can just replace the moss command with any of these three:

  • cargo run for a debug build
  • cargo run --release for a release build
  • cargo run --profile=release-with-debug for a release build with debug info

Usage

Moss source files use the .moss file extension, and can be made into executable scripts on Unix OSes via the #!/usr/bin/env moss shebang. For instance:

examples/hello.moss

Or, equivalently:

moss examples/hello.moss

Specifically, this implicitly invokes the run subcommand of the compiler:

moss run examples/hello.moss

You can alternatively use the build command to output WebAssembly code for WASI P1:

moss build examples/hello.moss | wasm-tools print

This is supported by many WebAssembly engines, such as Wasmtime which is what moss run uses internally:

moss build examples/hello.moss | wasmtime -

Language

Documentation pending.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License.

About

The contextual programming language.

Resources

License

Contributing

Stars

Watchers

Forks