mess
is a simple programming language intended to be embedded in other languages, primarly Rust and
in the future, via the mess-sys
crate, also C and other languages with a C interface.
This code is based on older projects of mine from around 2020.
Primarily to learn how parsers, lexers, compilers and bytecode interpreters work and play together.
Also - why not?
Nothing special really - syntax is similar to Rust and TypeScript.
mess
is statically typed and supports (non-checked) references, interfaces, structs (containers) etc.
// Containers are like structs.
// They contain data and methods
cont Vector {
// Member variable declaration
pub x: float;
pub y: float;
// Static functions do not take a "this" parameter
pub fun new(x: float, y: float) ~ Vector {
return Vector {
x: x,
y: y
};
}
// Member functions take a "this" parameter
pub fun length(&this) ~ float {
return float::sqrt((this.x * this.x) + (this.y * this.y));
}
}
// Interfaces are... well, interfaces
intf Printable {
fun print(&this);
}
// Syntax is inspired by rust
impl Printable for Vector {
fun print(&this) {
std::print(this.length());
}
}
// The main entry point
ext fun main() {
// Variable declarations support auto typing
var vec = Vector::new(2.0, 3.0);
// Or manually specified types
var number: int = 4;
// "on" statements are essentially "if"s
on number > 4 {
std::print("This is impossible!\n");
} else {
// Example of dynamic polymorphism
var printable: &Printable = &vec;
printable.print();
}
}
mess
- Core crate that you will use when embedding in Rustmess-api
- Contains structs, functions and macros for defining an API to use in scriptsmess-cli
- Simple CLI program for running script filesmess-core
- Internal crate containing common definitionsmess-jit
- AMD64 based JIT compilermess-vm
- Bytecode interpreter and accompanying compilermess-sys
- Crate for the (eventual) C bindings
This project is currently in a NON-WORKING state, as i am restructuring the entire codebase from my
previous projects. Please be patient while i work this out.
This project is licensed under the Apache v2 License.
See LICENSE.md
for details.