Skip to content
@mech-lang

Mech Programming Language

A language for developing data-driven, reactive systems

Mech is a language for developing data-driven, reactive systems like robots, games, and interfaces. It makes composing, transforming, and distributing data easy, allowing you to focus on the essential complexity of your project.

You can try Mech online at try.mech-lang.org. Read about progress on our blog, and follow us on Twitter @MechLang.

An Example Mech Program

Bouncing Balls Simulation
==========================
 
This program is a forward kinematic simulation of three balls 
bouncing in a 2D bounded arena. The balls are accelerated by 
simulated gravity and are repelled by the bounds of the arena.

#balls = [|x<m> y<m> vy<m/s> vx<m/s>|
           20   10   2.4     0
           100  50   0       3
           300  100  0      -5]
#gravity = 9.8<m/s^2>
#dt = 16<ms>
#bounds = [x<m>: 500 y<m>: 600] 

Indented code runs in an asynchronous “block”. These blocks 
are composable and reactive; they recompute automatically when 
dependent data change, or some condition is met. This block 
updates the state the balls every 16ms.

  ~ #dt
  #balls.x,y :+= #balls.vx,vy * #dt
  #balls.vy :+= #gravity * #dt
 
The following block enforces boundary constraints, ensuring that 
the balls will never leave the arena.

  ~ #dt
  iy = #balls.x,y > #bounds 
  ix = #balls.x,y < 0
  #balls.x,y{iy} := #bounds
  #balls.x,y{ix} := 0
  #balls.vx,vy{iy | ix} := -#balls.vx,vy * 80%

Installation

Usage and installation instructions can be found in the documentation or the main Mech repository.

Documentation

Documentation is hosted online at mech-lang.org, and is open sourced on GitHub.

Project Roadmap

Mech is currently in the alpha stage of development. This means that while some features work and are tested, programs are still likely to crash and produce incorrect results. There is a "happy path" that works well, but it's quite narrow. We've implemented many language features, but most are incomplete and some are not yet implemented at all.

See ROADMAP.md for more.

License

Apache 2.0

Pinned

  1. mech mech Public

    🦾 Main repository for the Mech programming language. Start here!

    Rust 199 10

  2. docs docs Public

    Mech language reference, tutorials, how-to guides

    2 2

  3. examples examples Public

    Example programs written in Mech

    1

Repositories

Showing 10 of 11 repositories
  • mech Public

    🦾 Main repository for the Mech programming language. Start here!

    mech-lang/mech’s past year of commit activity
    Rust 199 Apache-2.0 10 1 0 Updated May 26, 2024
  • .github Public
    mech-lang/.github’s past year of commit activity
    0 0 0 0 Updated Oct 18, 2023
  • syntax Public archive

    Parser, compiler, formatter for Mech syntax

    mech-lang/syntax’s past year of commit activity
    Rust 3 Apache-2.0 2 0 2 Updated Jul 20, 2023
  • utilities Public archive

    Components shared between Mech repositories.

    mech-lang/utilities’s past year of commit activity
    Rust 0 Apache-2.0 0 0 0 Updated Jan 9, 2023
  • notebook Public
    mech-lang/notebook’s past year of commit activity
    Rust 0 Apache-2.0 0 0 0 Updated Jan 9, 2023
  • wasm Public archive

    Mech in the browser. Provides capabilities for canvas drawing, HTML, and user events.

    mech-lang/wasm’s past year of commit activity
    Rust 1 Apache-2.0 0 0 0 Updated Jan 4, 2023
  • program Public

    Coordinates Mech cores and handles loading machines (Mech libraries).

    mech-lang/program’s past year of commit activity
    Rust 1 Apache-2.0 0 0 0 Updated Jan 4, 2023
  • core Public archive

    The Mech language runtime. Defines tables, blocks, values, and the standard library.

    mech-lang/core’s past year of commit activity
    Rust 4 Apache-2.0 1 0 0 Updated Jan 4, 2023
  • docs Public

    Mech language reference, tutorials, how-to guides

    mech-lang/docs’s past year of commit activity
    2 Apache-2.0 2 1 1 Updated Aug 15, 2022
  • examples Public

    Example programs written in Mech

    mech-lang/examples’s past year of commit activity
    1 0 0 0 Updated Jan 1, 2022

Top languages

Loading…

Most used topics

Loading…