Skip to content
meh-projectPublic

About

Self-hosted compiler, runtime and standard library for Meh — an experimental systems language with deterministic ARC ownership, structured concurrency and C/C++ interop.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

Meh

Meh is an experimental systems language with a self-hosted compiler, deterministic reference-counted ownership, structured concurrency and C/C++ interop. Objective-C interop requires a macOS compiler host. The language and APIs remain provisional.

println("Hello, world!")

Language documentation lives in meh-docs. This checkout contains the current compiler, runtime, standard library, examples, tools, basic getting-started documentation and focused tests. The implementation roadmap is TODO.md.

Use @inc module and qualify imported names as module.Name. Legacy flat imports are deprecated and scheduled for removal.

Supported platforms

Target Current support
macOS ARM64 and x86_64 Native code generation by default. Hosted builds use the macOS SDK.
Linux ARM64 and x86_64 Native code generation by default with glibc and musl support. Dynamic ELF cross-builds support sysroot-free synthetic stubs; static or C cross-builds use a matching sysroot.
FreeBSD ARM64 and x86_64 Native code generation and hosted ELF linking with shared Meh libraries. Dynamic ELF cross-builds support sysroot-free synthetic stubs; static or C cross-builds use a matching FreeBSD 15.1 sysroot.
NetBSD ARM64 and x86_64 Native code generation and hosted ELF linking with shared Meh libraries. Hosted cross-builds use a NetBSD 11.1 sysroot.
Windows AMD64 Build runtime-free and hosted PE32+ console executables, static COFF libraries and DLLs. Hosted builds support embedded or shared Meh runtime and standard-library providers.
WASI Experimental IR emission. Hosted support is deferred until after v1.0.0.
Ennui and freestanding ARM64 and AMD64 Ennui uses native POOKA/ENCL output by default. Runtime-free ARM64 and AMD64 kernels use native code generation.

Linux, macOS and FreeBSD are the primary native platforms. NetBSD and OpenBSD are best effort. Embedded devices and practical WASM execution and embedding remain goals.

Build and install

With a working compiler, run from this checkout:

mehc build
mehc install

Use mehc shape wherever you previously invoked mehshape. It rewrites files in place by default. Use mehc shape -p - to format standard input to standard output.

Run mehc shape --lint [PATH…] for read-only semantic diagnostics. Lint accepts a source directory or a group of files and defaults to the current directory. Use --target OS/ARCH to select platform sources and --check to fail on warnings. Advisories pass this gate. Invalid input fails either way.

Use mehdoc --format html . to render the public API of a checked project. Markdown and versioned JSON are also available. Semantic documentation

Use mehc test for named cases, allocation budgets, seeded properties and function coverage. Compare repeated timings with mehc bench compare. Application testing

Inspect verified releases and their documentation with mehc modules --packages. Use mehc build --offline for cached builds. Module releases

The root mehkfile builds and installs mehc, meh-tools, mld, mob, mehdoc, mehdep, mehprof and mehloc. Use mehc build --record FILE with mehdep to explore build decisions. mehc/mehkfile builds only the compiler for self-hosting; install and package commands from mehc/ still select the full distribution plan.

With meh-bootstrap beside this checkout, build and install from the frozen seed:

./scripts/bootstrap.sh

mehc cache clear removes the selected project’s build entries and generated runtime/standard-library caches, including their separate build records. It keeps existing programme outputs, installed providers, downloaded modules and tools, and unrelated project build entries.

If you have no working compiler, start with a compatible release binary. See the retained quickstart and authoritative installation guide for prerequisites, prefixes, PATH, cross-compilation and package removal. Enable Bash or Zsh completion for command names, flags, option values and paths.

Distribution

LLVM code generation and emit-ir are reserved for experimental WASI builds. Supported native builds use Meh's in-process assembler and linker by default. External fallback uses CC or cc and LD or the platform's default linker. Use --cc or --linker to select tools explicitly, or set MEH_EXTERNAL_TOOLS=deny to require in-process build tools for native targets. Windows builds resolve COFF default-library names through the source directory, the selected SDK library directories and LIB. With standalone mld --pe, use -L DIR to add a library directory. Release builds omit local symbols from Darwin and ELF shared libraries. Use --strip never to retain them, or --keep-local-symbols with standalone Darwin mld. POOKA objects retain relocation symbols through linking. Their final ENCL images contain no symbol table.

An Ennui kernel build with --format pooka --linker-script PATH embeds the script and ELF section layout in the POOKA object. Link it with mld --format elf -o PATH or mld --format elf,raw -o STEM followed by the object path. The latter writes STEM.elf and STEM.img. The script supplies the entry point unless mld --entry overrides it.

See the backend guide for boundaries and release checklist for required acceptance.

Portable archives and the macOS installer contain one Meh root with bin/, lib/, essential docs/ and stdlib/. The compiler embeds matching library sources and target images; --stdlib selects an external tree. ./package produces gzip-compressed tar archives for macOS, Linux and FreeBSD, and ZIP archives for Windows amd64. The runtime bundles follow the same format. Use ./package --format tgz to produce a Windows tarball as well. For a single project, select the archive format with mehc package --format. The Linux archives and runtime bundles use musl and require the matching musl loader at /lib/ld-musl-aarch64.so.1 or /lib/ld-musl-x86_64.so.1. On a clean release tag it reuses complete archives in dist/ and restores any missing runtime bundles from those archives. Linux archives must contain a compiler with the matching musl interpreter to be reused. Use ./package --force to rebuild all targets. The root packager also builds the matching documentation archive in the sibling meh-docs/dist/ directory.

To check cold compiler build time, run scripts/check-static-build-time.sh pinned BASELINE_BUILDER CANDIDATE_BUILDER [CANDIDATE_REV]. Supply a baseline compiler built from the pinned revision (bebab921). For a historical comparison, pass its matching source revision in place of pinned. The candidate revision defaults to HEAD. The check runs three alternating pairs of mehc build mehc --static on the same machine with fresh caches and absent outputs. It fails when at least two pairs exceed the wall-time budget of 5% or an ARM64 reachability or function-generation budget of 10%. Each failing pair must also exceed one second for that metric. The check records per-build traces and timings under /tmp/meh-build.

Memory operation tracing

On native Darwin ARM64, use --runtime full with MEH_MEMORY_TRACE_OUTPUT to capture bounded allocation, ARC, lifetime, copy and allocator-reuse records. The decoder reports operation counts and user call sites; ordinary builds omit the instrumentation. See memory tracing for commands, controls and coverage.

Coroutine runtime tuning

MEH_CORO_BURST_PACE=1024 lets the initial coroutine yield after detaching a child when a compiler-marked local burst has at least 1,024 runnable tasks. This can reduce peak memory by letting completed tasks release their storage during submission. It also lets children run earlier. Pacing is disabled by default.

MEH_ARENA_SIZE=3584 selects a 3.5 KiB stack arena slot. This option can reduce peak memory when many short coroutine stacks coexist. Measure it with the application's own stack depth and worker policy.

On Linux AMD64, the runtime compacts eligible parked coroutine stacks in the arena and restores their running headroom before resuming them. This reduces memory use for large parked sets at the cost of copying on park and resume. Compaction requires the arena and is incompatible with stack clearing and ThreadSanitizer.

Documentation and tools

Related checkouts and validation

Keep related repositories as siblings for the documentation links above:

  • meh-bootstrap archives earlier compiler snapshots.
  • meh-docs: language documentation, component guides, reference, current findings and changelogs. The wishlist and implementation TODOs stay here.
  • meh-bench: benchmark scripts, programs and retained measurements; set MEH_BENCH_ROOT elsewhere.
  • meh-tests: larger test suites, including crypto/security, fuzz, network and guest acceptance; set MEH_TEST_ROOT elsewhere and MEH_COMPILER_ROOT when needed.

Focused compiler, sanitiser, coroutine, ABI, linker and runtime regressions stay here. Use test selection and evidence guidance for proportional checks. Full security and platform matrices remain explicit release validation.

Licensed under the MIT licence.

Release documentation

Run ./release vX.Y.Z to tag both checkouts, build and verify all packages, and publish one GitHub release. Run ./publish --check vX.Y.Z for local acceptance. The release guide covers signing identities, notarisation and resuming an interrupted release.

About

Self-hosted compiler, runtime and standard library for Meh — an experimental systems language with deterministic ARC ownership, structured concurrency and C/C++ interop.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

1 star

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages