Background image for header

samal

Simple And Memory-wasting Awesomely-functional Language

Samal is a new programming language which attempts to be the perfect general-purpose (embeddable) language.
It mixes the great type system and syntax of Rust with the functional style of Elixir and Haskell.
Get Started Learn GitHub

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)
    }
}