Plush is an experimental toy programming language and virtual machine for fun and teaching purposes. It follows a minimalistic design philosphy and draws inspiration from JavaScript, Lox, Lua, Python and Rust. Plush supports actor-based parallelism and is designed such that there is no global VM lock. The language has straightforward semantics and is built around a simple stack-based interpreter. The codebase is well-commented, has very few depencencies, and good cross-platform support. It has been tested on Linux, Mac and Windows. Please do note however that this project is very much a fun side-project and a work in progress. You're likely to run into bugs and missing features.
To get a feel for what Plush code looks like, have a look at the programs in the /examples directory. For a detailed guide to the Plush language, please see the Plush Language Guide.
Dependencies:
- The Rust toolchain
- The SDL2 libraries
Install the SDL2 package:
brew install sdl2Add this to your ~/.zprofile:
export LIBRARY_PATH="$LIBRARY_PATH:$(brew --prefix)/lib"Install the Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shInstall the SDL2 package:
sudo apt-get install libsdl2-devInstall the Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shFollow the Windows-specific instructions to install the Rust toolchain.
Get SDL2.dll from one of SDL2 Releases.
Copy SDL2.dll (unzip) to the root of your cloned repo.
cargo buildTo run the test suite:
cargo testTo run a plush script:
# See example programs under /examples, /benchmarks and /tests
cargo run examples/helloworld.psh
cargo run examples/plasma.pshThe code for Plush, its VM and associated tools is shared under the Apache-2.0 license. The example code in the /examples directory is shared under the Creative Commons CC0 license.
There is a lot of work to be done to get this project going and contributions are welcome.
A good first step is to look at open issues and read the available documentation. Another easy way to contribute is to create new example programs showcasing cool things you can do with Plush, or to report any bugs and issues you encounter. If you do report bugs, please provide as much context as possible, and the smallest reproduction you can come up with.
You can also search the codebase for TODO or FIXME notes:
grep -IRi "todo" .In general, smaller pull requests are easier to review and have a much higher chance of getting merged than large pull requests. If you would like to add a new, complex feature or refactor the design of Plush, I recommend opening an issue or starting a discussion about your proposed changes first.
Also please keep in mind that one of the core principles of Plush is to minimize dependencies to keep the VM easy to install and easy to port. Opening a PR that adds dependencies to multiple new packages and libraries is unlikely to get merged. If you believe you have a valid argument in favor of doing so, please open an issue to share your point of view.
If you think that Plush is cool, you can support my work via GitHub Sponsors ❤️