sl-sh-dev / sl-sh

Simple Lisp Shell
MIT License
37 stars 5 forks source link
lisp rust sl-sh
sl-sh logo

Simple Lisp Shell (pronounced slosh)

Rust

Note this is a new experimental version, see ./legacy/ for the original version (slush).

Simple Lisp SHell (slosh) is a lisp based shell written in Rust. It is not POSIX compliant and makes no effort to be. Sl-sh should run on any *nix platform as well as macOS (CI currently only tests against ubuntu and macOS).It is a Lisp-1 that is heavily inspired by Clojure and Common Lisp. It is a shell, it is a scripting language, and it is a REPL.

Some of the more prominent features:

Contains these crates:

Running

cargo run -p slosh

Installation

1. Get sl-sh

2. Build sl-sh

3. Use sl-sh as primary shell

mkdir -p /usr/local/bin
sudo install -m 755 target/release/slosh /usr/local/bin/
echo /usr/local/bin/slosh | sudo tee -a /etc/shells
chsh -s /usr/local/bin/slosh

4. (Optional) Configure slosh

The slosh configuration file lives at ~/.config/slosh/init.slosh.
If you run slosh and the file does not exist, a default one will be created for you.
Review your existing shell configuration files like ~/.bashrc and ~/.bash_profile and manually translate them to slosh syntax and add to your init.slosh file
For example, export JAVA_HOME="/usr/local/opt/openjdk@11/bin/java" becomes (sh "export JAVA_HOME='/usr/local/opt/openjdk@11/bin/java'")

Compiler

These are a subset of sl-sh forms and most work exactly the same. See the sl-sh docs at: https://sl-sh-dev.github.io/sl-sh/

Primitive types

Heap allocated objects (complex types)

Special Forms

The following special forms are currently in the compiler:

Compiled Forms

Normal forms follow normal calling evaluation. Note: These are all compiled to bytecode and once compiled are not dynamic anymore.

Features

slosh

Slosh is the shell and scripting language REPL using the compiler, vm and shell crates.

Built-in Forms

These forms (written in Rust but callable from Lisp) are supported.

Features

Links

Benchmarking

Generated documentation

The documentation site is served from the doc directory based on the doc/mk-site.sh script referenced in the github action .github/workflows/gh_pages.yml.

Documentation can be built and viewed locally as the documentation site is a static set of html files generated from the source code.

All of this is covered in doc/README.md

Must be compiled in lisp-test mode for appropriate documentation functions to be present (cargo build --features lisp-test).

Dev Notes

Development Tools

Just and the Justfile

Just is a command runner much like make, but with a simpler syntax.

Optionally, you can install Just and use it to help easily test or build slosh.

You can also read the Justfile in the root directory to see the common commands that we use to test and build the project.


To verify you've installed Just, run just in the project root which should list all available commands.

Now you can run just test instead of the verbose sh scripts/check-clippy-version.sh && cargo fmt && cargo clippy && cargo test --workspace.

It's also possible to set up shell completion scripts which makes it quite quick to find the right command.