Apache License 2.0

项目介绍

mech-lang/mech 是一个托管在 GitHub 上的开源项目,主要使用 Rust 编写,采用 Apache License 2.0 许可证,目前获得 301 个 Star、22 次 Fork。

仓库全名
mech-lang/mech
开源许可证
Apache License 2.0
Star 数
301
Fork 数
22
未关闭 Issue
199

README 摘要

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: See the docs for an extended version that runs live in…

完整内容见 GitHub 原始 README 或本页 。

常见问题

mech 用什么语言开发?

主要使用 Rust 编写,采用 Apache License 2.0 许可证,目前有 301 个 Star。

mech 可以免费商用吗?

仓库采用 Apache License 2.0 许可证,可免费使用与修改,商业使用请遵守许可证条款(例如保留版权声明与许可声明)。

如何获取 mech 的源码?

可以直接克隆仓库:git clone https://github.com/mech-lang/mech.git,默认分支为 main;安装与运行步骤见仓库 README。

mech 最近还在维护吗?

仓库最近一次更新为 2 天前,当前有 199 个未关闭 Issue;Star 数为 301,可作为社区活跃度的参考。

关于

GitHub 原始描述(英文)

🦾 Mech is a programming language for building data-driven systems like robots, games, and interfaces. Start here!

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

语言占比

CSS
Dockerfile
HTML
Inno Setup
JavaScript
PowerShell
Rust

README

Mech Logo

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.


The following code implements FizzBuzz in Mech:

The classic FizzBuzz program expressed in Mech.

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.

Mech also supports a number of other features, such as pattern matching,state machines, comprehensions, and relational joins.


Here are a few more examples of Mech code to give you a sense of the language. First, the classic factorial program expressed in Mech:

The classic factorial program expressed in Mech.

Live Example


Pattern matching is a prominent feature throughout Mech. Here is an example of pattern matching on arrays:

A pattern match on arrays.

Live Example


State machines are Mech’s way of expressing protocols, processes, and asynchronous computations. Here is an example of a simple state machine that counts down from a given number:

A simple state machine that counts down from a given number.

Live Example


Mech also supports comprehensions and relational joins. Here is an example of a comprehension that finds the friends of friends in a social graph by joining two generators over a common variable:

A comprehension that finds the friends of friends in a social graph.

Live Example

Run Mech

There are several ways to get Mech running on your machine, which you can find in the documentation. But 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:

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.

评论

暂无评论