octalide/mach: A systems programming language with no hidden behavior. 路 GitHub

🚀 Explore this insightful post from Hacker News 📖

📂 **Category**:

💡 **What You’ll Learn**:

CI
License
Code Size
Last Commit
Issues

Mach is a statically-typed, compiled systems language designed to be simple, fast, verbose, and intuitive.

We have an official Discord!

Mach is designed with the following principles in mind:

  • Simplicity: Mach is built to be easy to learn, read, write, and maintain.
  • Explicivity: Mach is explicit and verbose. WYSIWYG, always. Computers are not magic. Your code should not promote this illusion.
  • Maintainability: Mach’s semantics and design principles prioritize long-term maintainability over short-term convenience.

Mach is NOT designed to prioritize:

  • Features: Batteries are not included. Ever.
  • Flexibility: Mach does not allow for many ways to do the same thing.
  • Code Reduction: Mach is explicit and verbose by design. More code is not worse code.
  • Hand-holding: Mach will not stop you from doing dangerous things. Safety is a decision made by the programmer, not a restriction to be imposed upon them.

Read the language reference before installing. The docs are written more like a pamphlet than a bible and assume familiarity with basic programming concepts from other languages.

Mach builds itself, so building from source needs an existing mach — install the latest release first.

git clone --recurse-submodules https://github.com/octalide/mach
cd mach
mach build .

The compiler is written to out//bin/mach.

Command Description
build compile the current project to an executable or object
run build and execute the current project (-- args... forward to the program)
test build and run the project’s tests
dep manage vendored dependencies (list, add, remove, sync, vendor)
init scaffold a new project (--lib, --name, --force)
doc generate Markdown reference docs from source doc-comments
help show usage; mach help for detail

Run mach help for more information about a specific subcommand, or
see the full CLI reference.

The following examples require the standard library as a dependency. For a standalone starting point, see the Mach Sieve project, or run mach init to scaffold one.

use          std.runtime;
use print:   std.print;

$main.symbol = "main";
fun main(argc: i64, argv: **u8) i64 🔥
use          std.runtime;
use print:   std.print;

fun fibr(n: u64) u64 {
    if (n < 2) {
        ret n;
    }
    ret fibr(n - 1) + fibr(n - 2);
}

$main.symbol = "main";
fun main(argc: i64, argv: **u8) i64 {
    print.printf("fib(%d) = %d\n", 10::i64, fibr(10));
    ret 0;
}
use          std.runtime;
use print:   std.print;

fun fact(n: u64) u64 {
    if (n == 0) {
        ret 1;
    }
    ret n * fact(n - 1);
}

$main.symbol = "main";
fun main(argc: i64, argv: **u8) i64 {
    print.printf("fact(%d) = %d\n", 10::i64, fact(10));
    ret 0;
}

The full language reference is in doc/language/. The
build system is documented in:

The inspiration for Mach comes from too many languages to count.

Direct inspiration for the compiler itself comes from a few specific sources:

Mach stands on the shoulders of countless giants that have contributed to the development of these languages either directly or by proxy. It is out of respect for their work that Mach will always be fully open source. Thank you all.

We welcome contributions to Mach! If you would like to contribute, please read our contributing guidelines first.

Mach is licensed under the MIT License.

{💬|⚡|🔥} **What’s your take?**
Share your thoughts in the comments below!

#️⃣ **#octalidemach #systems #programming #language #hidden #behavior #GitHub**

🕒 **Posted on**: 1780961773

🌟 **Want more?** Click here for more info! 🌟

By

Leave a Reply

Your email address will not be published. Required fields are marked *