Skip to content

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.

The compiler is a dependency-free Python program under bootstrap; see bootstrap/README.md for its pipeline and docs/design/semantics.md for the working design record. A second compiler, written in Moss, lives under src and now compiles itself: see docs/implementation/selfhosting.md.

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 puts the moss development launcher on your PATH. It builds a native driver that links Wasmtime and Binaryen, both from Nix. Python 3.12+ is needed only to bootstrap a changed self-hosted compiler in a source checkout; the packaged compiler already contains that result.

nix build produces the normal Nix package. nix build .#standalone produces a bundle for Linux or macOS that can be copied and used without Nix; an x86-64 Windows bundle can be cross-compiled from x86-64 Linux with nix build .#windows. Each bundle contains a driver with the optimized self-hosted compiler embedded in it, plus the standard library under share/moss/lib.

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 run, which compiles the program and executes the resulting Wasm:

moss run examples/hello.moss

Pass an explicit Binaryen optimization level with -O0 through -O4, -Os, or -Oz.

You can alternatively use the build command to output WebAssembly code for WASI P1, supported by many WebAssembly engines such as Wasmtime:

moss build examples/hello.moss > hello.wasm && wasmtime hello.wasm

Documentation

See the docs folder.

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the MIT License.

About

The contextual programming language.

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Contributors

Languages