Warning
THIS PROJECT WAS WRITTEN MOSTLY BY MULTIPLE LARGE LANGUAGE MODELS (LLMs). Human direction, review, and testing are part of the process, but generated code can contain subtle bugs, incorrect assumptions, and optimistic documentation. This is an experimental language and toolchain. Read the code, run the tests, and bring your curiosity. The robots brought their own confidence.
Maylang is a small programming language with a self-hosted compiler, strict
checking by default, and direct native executable output. mayc emits machine
code and packages ELF, Mach-O, or PE images without an external assembler or
linker. The active compiler and language server are written in Maylang.
Its signature feature is may { … }: try something uncertain and provide an
otherwise { … } fallback. A language named after a possibility should probably
have a plan B.
fun double(value: Int) -> Int {
return value * 2;
}
let answer: Int = double(21);
print(answer); // 42. The compiler has read the same books you have.
Host requirement: Linux x86-64. The repository includes one bootstrap
compiler binary so you can start without the archived Rust toolchain.
Python 3 and readelf (from binutils) are needed for the verification suite.
git clone https://github.com/mirged/maylang.git
cd maylang
toolchain/mayc/mayc_new --version
toolchain/mayc/mayc_new examples/hello.may -o /tmp/maylang-hello
/tmp/maylang-hello
toolchain/mayc/mayc_new --check examples/strict.mayExpected hello output:
Hello, Maylang!
Hello, world!
Build and verify the compiler, including successive self-hosting generations:
toolchain/mayc/tests/run.shKeep the compiler with its runtime sidecars. The mayc_new launcher wires up
those paths; copying just the underlying executable elsewhere is insufficient.
See the compiler guide for the build pipeline,
runtime selection, benchmarks, and detailed verification commands.
- Strict checking: typed parameters, inferred local bindings and function results, explicit returns, structs, generics, and collection checks.
- Fault boundaries: may,otherwise, structured errors, nil coalescing (??), and safe navigation (?.).
- Everyday tools: pattern matching, closures, pipelines, modules, JSON, file I/O, and a standard library.
- Close to the metal: native code, raw pointers, memory operations, syscalls, and C ABI calls in the full runtime.
- Developer tools: a Maylang language server, VS Code extension, package manager, and an interactive reference site.
Start with the strict language guide. The
historical tour preserves older syntax for reference;
use --legacy only when intentionally compiling older untyped programs.
The Rust implementation is archived and is not the active toolchain.
The compiler itself runs on Linux x86-64. It can emit these targets:
toolchain/mayc/mayc_new --target arm64-linux examples/hello.may -o /tmp/hello-arm64The full dynamic runtime is Linux x86-64 only. Core programs use a smaller runtime; closures, maps, floats, exceptions, fibers, and FFI require the full runtime. Cross-target execution has emulator checks; native macOS and Windows launches are not yet verified here. See target details.
Try the terminal game:
toolchain/mayc/mayc_new example_projects/games/starfall/main.may -o /tmp/starfall
/tmp/starfall demoThe full runtime's collector has a documented corruption issue under sustained allocation workloads. Core allocation retains heap chunks until process exit. Some features and ABIs have target-specific restrictions. Read the compiler limitations before relying on a feature. Performance reports describe particular local workloads, not universal speed promises. The badges above describe the project; they do not claim passing CI.
Build outputs, dependencies, scratch binaries, and local assistant configuration
are ignored. One Linux x86-64 bootstrap compiler is deliberately versioned at
toolchain/mayc/build/bin/mayc_new so a fresh clone can build itself.
See the community roadmap for planned milestones, linked issues, and how to propose changes to priorities and scope. The plan evolves with community needs and implementation evidence.
Small reproductions and focused changes are welcome. Include the source that
triggers a bug, the compiler version, the target, and the actual output. For
compiler changes, run toolchain/mayc/tests/run.sh and the relevant specialized
checks listed in the compiler guide. Review generated code with the same care
as any other contribution.
The compiler version lives in MAYC_VERSION near the top of
main.may. Maylang uses immutable let bindings for
constants. Update the bootstrap executable and version badge when making a
versioned release.
You found the emergency otherwise clause.
If the compiler becomes self-aware, please ask it to fix the garbage collector before discussing philosophy.
Achievement unlocked: read the README all the way down. No dependencies were installed to award this achievement.