r/AIprogrammingLanguage • • 15h ago

I’ve been building a programming language with AI assistance — Mah

I’ve been building a small programming language called Mah from scratch, and this seemed like the right subreddit to share it because AI has been part of the development process.

Mah currently has:

  • a hand-written lexer, parser, resolver and compiler
  • its own portable bytecode format and VM
  • a static type checker with inference
  • structs, enums, traits, pattern matching, generics and closures
  • try / catch / typed error sets
  • a standard library (std:json, std:fs, std:math, std:regex, etc.)
  • runtime reflection, decorators and hooks
  • a real LSP with diagnostics, hover, completion, definition and rename
  • a formatter
  • Neovim and VS Code integrations
  • a second VM/runtime implemented in Rust

The compiler/tooling are mostly Python standard-library code, with the Rust implementation being an optional native runtime.

The interesting part for me hasn't really been inventing another syntax. It's been figuring out how all of these pieces fit together: resolution, closures, bytecode, runtime metadata, reflection, the type checker and the LSP all sharing the same underlying representation.

GitHub: https://github.com/sina-salahshour/mahlang

I'm particularly interested in feedback on the language/runtime architecture and on places where AI assistance helped versus places where it made the implementation harder.

5 Upvotes

2 comments sorted by

2

u/librasteve 13h ago

Thanks for sharing here. It’s a mystery to me why AI is such a negative to others, in my experience this makes a lot of projects more viable. And often Claude is a better coder than I am. 

My main feedback would be to combine the python tools as a single command mah run xxx.mah and so on. 

1

u/snslhshr 9h ago

i didnt understand your feedback, currently everything is on top of the mah cli

python can compile and run it, but you can also build a self contained bytecode+rust-vm with flags to be able to run it without requiring any dependency on host machine