Go to file
Julius 31c3827e96
Add support for operators to custom type
This is done by implementing the required functions for your custom type.

Sadly I could not solve this by using the regular traits like `Add`,
since I can't easily check if a different trait is implemented.
2022-07-04 22:23:59 +02:00
src Add support for operators to custom type 2022-07-04 22:23:59 +02:00
.gitignore Initial Commit 2022-07-02 23:42:15 +02:00
Cargo.lock Add custom types. Make an attempt at method calls. 2022-07-03 20:32:31 +02:00
Cargo.toml Add custom types. Make an attempt at method calls. 2022-07-03 20:32:31 +02:00
README.md Add return to functions 2022-07-04 15:36:03 +02:00
test.foo Add support for operators to custom type 2022-07-04 22:23:59 +02:00

README.md

Name TBD

i guess it's an embedded language?

Features

Math: +, -, *, /, %

Equality: ==, !=, >, <, >=, <=

Some basic types: String, char, int, float, bool

Custom rust types: if it implements CustomValue, it can be used

Functions: foo(x)

Methods: x.foo()

Any function is also a method, as long as it has at least one parameter. The same also works the other way around.

Some control flow: while and if/else if/else

Functions: can be defined in both the language and in Rust.

The functions support a return in the form of return x; and x as the last element.

As long as the final element is an expression of some kind, it will be seen as a return value in a function.

For some sample code, check test.foo (extension also TBD)