Objlab
← News
Linguaggi e compilatori

Show HN: Mach – Un linguaggio di sistema compilato in cerca di contributi

Sintesi redazionale: Ciao HN, sono il creatore di Mach ( https://github.com/octalide/mach o https://machlang.org ). Due giorni fa abbiamo finalmente raggiunto la completa autonomia di hosting.. Fonte originale: https://github.com/octalide/mach

<p>We have an official Discord!</p><p>Mach is a self hosted, statically-typed, compiled systems language designed to be simple, fast, verbose, and intuitive. Mach was created for projects like compilers, runtimes, operating systems, tooling, and embedded systems -- anywhere performance is a requirement and hidden behavior is a liability. The language is deliberately small and explicit: what you read is what executes, every cost is visible in the code that incurs it.</p><p>Mach does not rely on any external dependencies for the compiler or during runtime -- no LLVM, no linking to libc, no system linker or other tools. The entire compiler and all base language features are written in native Mach.</p><p>Memory is managed manually. There is no garbage collector and no hidden allocation. Memory flows through allocators that you create and pass explicitly, and the standard library is built around that style end to end: anything that allocates takes an allocator, and anything that doesn&#x27;t never will.</p><p>Batteries are not included. Many ways to do the same thing are not provided, and the language will not stop you from doing dangerous things. Safety is a decision made by the programmer, not a restriction imposed upon them.</p><p>Use Mach when you want C&#x27;s reach with one coherent toolchain: a single binary that builds, links (no external linker), tests, vendors dependencies, and cross-compiles.</p><p>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.</p><p>Install the latest release with one line:</p><p>`curl -fsSL https://machlang.org/install.sh | sh`</p><p>On Windows (PowerShell):</p><p>`irm https://machlang.org/install.ps1 | iex`</p><p>Precompiled binaries are also available directly on the releases page.</p><p>Mach builds itself, so building from source needs an existing `mach`</p><p>installation.</p><p>```<br>git clone https://github.com/briar-systems/mach<br>cd mach<br>mach dep pull<br>mach build .<br>```</p><p>The compiler is written to `out/&lt;target&gt;/bin/mach`</p><p>, where `&lt;target&gt;`</p><p>is the selected target name.</p><p>The following examples require the standard library as a dependency. For a standalone starting point, see the Mach Sieve project, or run `mach init`</p><p>to scaffold one.</p><p>```<br>use std.runtime;<br>use print: std.print;<br>#[symbol(&quot;main&quot;)]<br>fun main(argc: i64, argv: **u8) i64 {<br>print.println(&quot;Hello, World!&quot;);<br>ret 0;<br>}<br>```</p><p>```<br>use std.runtime;<br>use print: std.print;<br>fun fibr(n: u64) u64 {<br>if (n &lt; 2) {<br>ret n;<br>}<br>ret fibr(n - 1) + fibr(n - 2);<br>}<br>#[symbol(&quot;main&quot;)]<br>fun main(argc: i64, argv: **u8) i64 {<br>print.printf(&quot;fib({}) = {}\n&quot;, 10::i64, fibr(10));<br>ret 0;<br>}<br>```</p><p>```<br>use std.runtime;<br>use print: std.print;<br>fun fact(n: u64) u64 {<br>if (n == 0) {<br>ret 1;<br>}<br>ret n * fact(n - 1);<br>}<br>#[symbol(&quot;main&quot;)]<br>fun main(argc: i64, argv: **u8) i64 {<br>print.printf(&quot;fact({}) = {}\n&quot;, 10::i64, fact(10));<br>ret 0;<br>}<br>```</p><p>The full language reference is in `doc/language/`</p><p>. The<br>build system is documented in:</p><p>`doc/manifest.md`</p><p>: the`mach.toml`</p><p>manifest reference`doc/cli.md`</p><p>: the`mach`</p><p>command-line reference`doc/distribution.md`</p><p>: shipping an application to users</p><p>The inspiration for Mach comes from too many languages to count.</p><p>Direct inspiration for the compiler itself comes from a few specific sources:</p><p>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.</p><p>We welcome contributions to Mach! If you would like to contribute, please read our contributing guidelines first.</p><p>Mach is licensed under the MIT License.</p>