#programming-language #interpreter #operator-overloading #language #sloth #error-management

app slothlang

A weird, slow and a bit moldy interpreted programming language

15 releases (8 stable)

1.4.0 Apr 11, 2023
1.3.0 Mar 31, 2023
1.2.1 Dec 8, 2022
1.1.0 Oct 29, 2022
0.1.1 Jul 30, 2022

#407 in Programming languages

50 downloads per month

Apache-2.0

205KB
4.5K SLoC

🦥 Sloth - The weird, slow and a bit moldy programming language

Sloth is an interpreted programming language, implemented in Rust. Its syntax is inspired by C-like languages, Rust, Python, and Lisp-like languages.
I do not ensure the stability of the language: use it at your own risk!

Syntax example

// Return the factorial of @0
define factorial: num -> num {
    @return = 1;
    i = 2;

    while <= i @0 {
        @return = * @return i;
        i = + i 1;
    };
}

define @main: num -> num {
    print(factorial(@0) "\n");
}

Some fundamentals of the Sloth syntax:

  • Operations use the Polish notation
  • Special symbols are prefixed with @: @main, @self, @return...
  • Functions return the content of the variable @return
  • Methods can modify the value referenced by @self
  • Functions/Methods arguments are named @0, @1, etc.

Features

Sloth does not provide common features like else blocks, for loops, etc. There is no error management yet, no compiled module yet, etc.

However, you can overload operators! 🎉

Installation

Install using cargo:

$ cargo install slothlang

I may provide executables in the future.

License

Sloth is licensed under the Apache-2.0 License.

Dependencies

~22MB
~464K SLoC