Mech Documentation

Getting Started

  1. Introduction

  2. Install Mech

  3. Build and Run Mech Programs

  4. Mech REPL

  5. Your First Mech Program todo

Platform Reference

Data Model

  • Data Types

    • atom - symbolic constants, often used for tags or enums

    • bool - logical values for true and false

    • empty - represents an absence of value

    • kind - a category of values

    • number - numeric values, including integers and floating-point numbers

    • string - sequence of UTF-8 characters representing text

  • Data Structures

    • map - stores key-value pairs for fast lookups

    • matrix - 2D array of homogenous values arranged in rows and columns

    • record - groups related fields, usually for representing structured data

    • set - unordered collection of unique values

    • table - collection of heterogeneous data organized into rows and columns

    • tuple - fixed-size, ordered grouping of heterogeneous values

  • Defining, Assigning, and Accessing Data todo - create data and change it

  • Indexing - access elements within data structures

  • Conversion todo - convert data from one kind to another

  • Broadcasting - apply operations over data structures

Program Model

  • comprehension - for constructing sets and matrices from predicates

  • function - reusable block of code that performs a specific task

  • match - construct for branching logic based on pattern matching

  • pattern - match and destructure data

  • state machine - defines a set of states and transitions between them

  • Synth todo

  • Gen todo

  • Modules todo

  • Programs todo

  • Error Handling todo

  • Tests todo

System Model

Coming v0.4

  • Capabilities todo

  • Distributed Computation todo

  • Concurrency todo

Mechdown Reference

Standard Library

Guides

Project Design Documents

Examples

  • Fizz Buzz - a classic programming exercise that demonstrates the use of Mech's data model and operators.

  • N-Body Simulation - a simulation of gravitational interactions between multiple bodies.

  • Extended Kalman Filter - an implementation of the Extended Kalman Filter algorithm for state estimation.

  • Bubble Sort - the classic bubble sort algorithm implemented with state machines.