Machine is a compiled systems language project implemented in C17. The current compiler front-end reads .mne source, performs lexical analysis, parsing, semantic checks, and then emits either generated C or x86_64 assembly depending on the selected backend. The generated output is then compiled or linked into the final program.
On Fedora/RHEL/CentOS:
sudo dnf install -y gcc make SDL2-devel SDL2_image-devel nasmOn Debian/Ubuntu/Kali:
sudo apt install -y gcc make libsdl2-dev libsdl2-image-dev nasmOn ArchLinux/Manjaro:
sudo pacman -S gcc make sdl2-compat sdl2_image nasmFor other distributions, manually compile and install dependencies:
Window, image, and related hosted runtime features depend on SDL2 and SDL2_image being available when the hosted runtime object is built.
make CompilationThis produces:
./machinebuild/machine_runtime.o
make cleansudo make installThe install target now installs:
- the
machinecompiler - hosted, freestanding, and baremetal runtime support files
- Vim syntax files for
.mne - bundled example
.mneprograms - project documentation, including the directive guide
sudo make uninstall./machine --help./machine --version./machine path/to/file.mne -o output_nameExample:
./machine test/struct.mne -o structMachine is a compiled language implementation.
More precisely:
- the compiler front-end is written in C17
- Machine source can be lowered to generated C or x86_64 assembly
- the selected backend is then compiled or linked into a native output
- the result is a native executable or baremetal ELF, depending on the selected target
So Machine is not an interpreter, and it is not a mixed interpreter/JIT runtime.
When the first meaningful line of a source file is:
bin.runtime
the compiler switches runtime discovery into installation/project mode. It will try, in order:
/usr/local/lib/machine/machine_runtime.o+/usr/local/include/machine/machine_runtime.h- a project-local
build/runtime bundle next to the.mnefile - a project-local runtime bundle in the project root
- current-working-directory fallback copies
This allows application projects to compile without manually copying runtime files into every project directory.
MachinePrograms/
├── Compilation/ # CLI entry points and command handling
├── include/ # public and internal headers
├── src/ # compiler and runtime implementation
├── test/ # bundled example and test .mne programs
├── vim/ # Vim syntax, ftdetect, and ftplugin files
├── build/ # generated runtime object and other build outputs
├── LICENSE
├── README.md
├── README.zh-CN.md
├── use_order.md
├── use_order.zh-CN.md
├── Makefile
└── m.sh
- lexer: tokenization of Machine source
- parser: expressions, statements, top-level declarations, and directives
- semantic analysis: symbol resolution, type checks, and diagnostics
- C backend: emits generated C
- x86_64 asm backend: emits GNU-style x86_64 assembly
- runtime layers:
runtime.cfor Linux hosted programsruntime_freestanding.c+ entry assembly for freestanding targetsruntime_baremetal.c+ entry assembly + linker script for baremetal targets
- CLI: command-line parsing, backend/target selection, final compilation pipeline
Machine accepts both 2-space and 4-space block indentation. A file may mix them across different blocks. Each nested block may increase indentation by either 2 or 4 spaces, and dedents must return to a previously established indentation column.
For a user-local install:
make vim-installFor a system-wide install, sudo make install now also installs the syntax files into a system Vim runtime location.
After sudo make install, these locations are populated:
/usr/local/bin/machine/usr/local/lib/machine//usr/local/include/machine//usr/local/share/machine/examples//usr/local/share/doc/machine//usr/local/share/vim/vimfiles/
This project involved the use of the AI tool ChatGPT 5.4 MikuTrive assisted in the development of this Machine programming language project.
@ellelkktrraaa
Machine is distributed under GPL-3.0. See LICENSE.