Skip to content

lizzyman04/mlang

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

85 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MLang

CI Docs License: MIT

A math-first, statically typed programming language implemented as a tree-walking interpreter in Rust.

Documentation · Examples · Contributing


Install

curl -fsSL https://lizzyman04.github.io/mlang/install.sh | sh

Or build from source:

git clone https://github.com/lizzyman04/mlang.git
cd mlang
cargo build --release
./target/release/mlang examples/hello.mth

Example

struct Point {
    int x
    int y
}

int distance(Point a, Point b) {
    int dx = a.x - b.x;
    int dy = a.y - b.y;
    return dx * dx + dy * dy;
}

main() {
    Point p1 = Point{ x = 0, y = 0 };
    Point p2 = Point{ x = 3, y = 4 };
    print(distance(p1, p2));   # 25
}

Language features

  • Types: int, dec, txt, bool, array<T>, structs
  • Control flow: if/else, while, for/in, break, continue
  • Functions with recursion and forward references
  • User-defined structs with field access and mutation
  • Built-in I/O: print, read (auto-detects int/dec/txt)
  • Type casts: int(x), dec(x), txt(x)

Documentation

Full language reference, contributor guide, and architecture docs are at lizzyman04.github.io/mlang.

For internals and contribution workflow, see the docs/ directory.

License

MIT — see LICENSE.

About

A math-first programming language.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages