WLambda - Embeddable Scripting Language for Rust

This crate provides you with a small and simple embeddable scripting language. It's primary feature are functions and calling functions. It could be viewed as Lisp without parenthesis.

Here are some of it's properties:

The API relies on a data structure made of VVal nodes.

Example WLambda Code

Just a quick glance at the WLambda syntax and semantics.

```wlambda

This is a comment

Definition:

!a = 10;

Assignment:

.a = 20;

List variable definition:

!a_list = $[1, 2, 3, 4];

Map assignment:

!a_map = ${a: 10, b: 20};

Function definition/assignment:

!a_func = { _ + _2 # Arguments are not named, they are put into _, _2, _3 };

afunc(2, 3); # Function call afunc 2 3; # Equivalent function call

There is no if statement. Booleans can be called

with two arguments. The first one is called when the boolean

is true, the second one is called when the boolean is false.

[a == 10] { # called if a == 10 } { # called if a != 10 }

Counting loop:

!:ref sum = 0; # Defining a reference that can be assignment # from inside a function.

range calls the given function for each iteration

and passes the counter as first argument in _

range 0 10 1 { # This is a regular function. sum = sum + _; }

range loop with break

!breakvalue = range 0 10 1 { [ == 5] { break 22 }; };

Basic OOP:

!someobj = ${}; someobj.dosomething = { # do something here }; someobj.do_something(); # Method call ```

Currently there are many more examples in the test cases in compiler.rs.

Basic API Usage

The API is far from feature complete, but this is roughly how it looks currently:

``` use wlambda::prelude::createwlambaprelude;

let s = "$[1,2,3]"; let r = wlambda::compiler::eval(&s).unwrap(); println!("Res: {}", r.s()); ```

Possible Roadmap

There are several things that can be added more or less easily to WLambda. But I am currently working on making the language more complete for real world use. So my current goals are:

Future plans could be:

License

This project is licensed under the GNU General Public License Version 3 or later.

Why GPL?

Picking a license for my code bothered me for a long time. I read many discussions about this topic. Read the license explanations. And discussed this matter with other developers.

First about why I write code for free at all:

Those are the reasons why I write code for free. Now the reasons why I publish the code, when I could as well keep it to myself:

Most of those reasons don't yet justify GPL. The main point of the GPL, as far as I understand: The GPL makes sure the software stays free software until eternity. That the user of the software always stays in control. That the users have at least the means to adapt the software to new platforms or use cases. Even if the original authors don't maintain the software anymore. It ultimately prevents "vendor lock in". I really dislike vendor lock in, especially as developer. Especially as developer I want and need to stay in control of the computers I use.

Another point is, that my work has a value. If I give away my work without any strings attached, I effectively work for free. Work for free for companies. I would compromise the price I can demand for my skill, workforce and time.

This makes two reasons for me to choose the GPL:

  1. I do not want to support vendor lock in scenarios. At least not for free. I want to prevent those when I have a choice. And before you ask, yes I work for a company that sells closed source software. I am not happy about the closed source fact. But it pays my bills and gives me the freedom to write free software in my free time.
  2. I don't want to low ball my own wage and prices by giving away free software with no strings attached (for companies).

If you need a permissive or private license (MIT)

Please contact me if you need a different license and really want to use my code. As long as I am the only author, I can change the license. We might find an agreement.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in WLambda by you, shall be licensed as GPLv3 or later, without any additional terms or conditions.

Authors