This repository specifies the MoonBit language behavior of:
- regex match expressions using
=~; lexmatchexpressions overStringandStringView; andlexscanexpressions over@lexbuf.Lexbuf,@lexbuf.AsyncLexbuf, and@lexbuf.StringScanner.
The specification targets moon 0.1.20260814 and moonc v0.10.8+8606a5800.
The published MoonBit v0.10.7 documentation is linked for comparison. Version differences and publicly reproducible implementation divergences are recorded separately without exposing non-public compiler materials.
- Scope and conformance
- Regex patterns and matching model
- Regex match expression (
=~) lexmatchexpressionlexscanexpression- Diagnostics
- Conformance coverage matrix
- Review questions
- Known implementation issues and limitations
The specification and executable conformance suite are both present. Runtime, typing, diagnostic, warning, formatting, multi-backend, Unicode, streaming, and coverage-audit tests correspond directly to the IDs in the conformance matrix.
The current matrix contains 239 independently testable requirements. The ordinary runtime/type layer contains 128 tests; diagnostic fixtures and format fixtures cover the remaining compile-time requirements and interactions.
Run the complete suite with:
bash scripts/test_all.shThe full command performs:
- formatting and warning-free project checks;
- debug and release tests across all supported MoonBit backends;
- compile-fail and warning fixtures with diagnostic-code assertions;
- a canonical formatter fixture; and
- a coverage-ID audit that fails if any matrix row lacks a test.
With the baseline stable toolchain, --target all runs wasm, wasm-gc,
js, and native. The separately listed llvm target is experimental and is
not runnable unless the toolchain installation includes its LLVM core bundle.
Individual layers can also be run with moon test,
bash diagnostics/run.sh, bash scripts/check_format_fixture.sh, and
bash scripts/check_coverage_ids.sh.
The diagnostic runner is intentionally strict. A baseline compiler that still has a divergence listed in Known implementation issues and limitations will fail the corresponding fixture until that compiler fix is available in the invoked toolchain.
To test a locally built compiler while keeping the installed moon driver,
set SPEC_MOONC_OVERRIDE:
SPEC_MOONC_OVERRIDE=/path/to/moonc bash scripts/test_all.sh