samal is simple
- Compiler & VM only have about 10.000 lines of C++-Code
- Functional style makes samal a joy to use
- The syntax is very similiar to Rust
fn greetFiveTimes(name : [char]) -> () {
Core.times(5, fn() -> () {
print(concat("Hello ", name))
})
()
}
fn main() -> () {
greetFiveTimes("Bob")
}
samal is fast(ish)
- A very basic JIT-Compiler can translate bytecode directly to x86-64 assembly
- An interpreter is available for all platforms & bytecode instructions that are not supported
- Seamless and efficient switching between JIT-Code and interpreter
samal is flexible
- All standard libraries are optional
- The language can easily be extended using native functions
- The whole compiler & VM can be embedded into other programs with an easy to use API
// Run the function callback num times and
// return a list of the return values
fn times<T>(num : i32, callback : fn() -> T) -> [T] {
if num < 1 {
[:T]
} else {
callback() + times(num - 1, callback)
}
}