Mech
🦾 Mech is a programming language for building data-driven systems like robots, games, and interfaces. Start here!
Install / Use
/learn @mech-lang/MechREADME
Mech is for building data-driven, reactive systems like robots, games, embedded devices and more.
It simplifies data distribution, transformation, and analysis so you can focus on your project.
- Try Mech online in your browser.
- Read the docs to learn the language.
- Follow our blog to stay updated on new developments.
The following code implements FizzBuzz in Mech:
<p align="center"> <img width="680px" src="https://mech-lang.org/img/fizzbuzzblock.png" alt='The classic FizzBuzz program expressed in Mech: x:=1..=10; ~out<[string]>:=x; ix2:=(x % 2) == 0; ix3:=(x % 3) == 0; out[ix2]="✨"; out[ix3]="🐝"; out[ix2 && ix3]="✨🐝";'> </p>See the docs for an extended version that runs live in your browser.
Some notable features of Mech are demonstrated in this short program:
- Concise Syntax: Expressive and flexible, with no need for keywords or semicolons; Mech programs are generally shorter than in other languages.
- Broadcast Operations: Vector operations apply elementwise automatically, removing explicit loops and enabling efficient vectorization.
- Logical Indexing: Vector elements are conditionally selected using broadcast logic operations, enabling declarative iteration and parallel execution.
- Type Inference: Variable and expression types are inferred, so explicit type declarations are often unnecessary.
- Immutable: Variables are immutable unless specified, promoting safer code and easier reasoning.
- Rich Text: Mech programs support rich formatting and literate programming through Mechdown, a Markdown dialect.
Run Mech
There are several ways to get Mech running on your machine, which you can find in the docs. The easiest way to get started is to use the online REPL at try.mech-lang.org.
Documentation
New to Mech? Start with Learn Mech in Fifteen Minutes.
Comprehensive documentation is available at docs.mech-lang.org and open-sourced on GitHub.
Community
The Mech community gathers at a few places around the Internet:
- Discord - for live chat
- GitHub - for code and issues
- YouTube - for video tutorials
- Reddit - for help and general discussion
- Mailing List - for dev discussion
Feel free to stop by and introduce yourself -- we're happy to meet new users and answer questions!
Project Roadmap
Mech v0.3 is currently beta status, meaning while many intended features are implemented and working well, other features are incomplete, not tested, or undocumented.
A Brief Roadmap:
- ☑️ v0.1 - proof of concept system - minimum viable language implementation
- ☑️ v0.2 - data specification - formulas, defining and manipulating data
- 📍 v0.3 - program specification - functions, modules, state machines, Mika
- ☐ v0.4 - system specification - tools, distributed programs, capabilities
For more details, read the ROADMAP.
Notice
Mech should be considered unstable and therefore unfit for use in critical systems until v1.0 is released.
License
Licensed under Apache 2.0.
