cli API

Purpose

cli is the native executable floating-conformance. It dispatches its arguments to one of the four conformance runners (gda, testfloat, mpfr, itl) and exits with the runner’s code. The package has no public MoonBit items; this page documents its command-line interface. The tutorial shows typical invocations and the design page explains the layering.

Importing

cli is an executable package (pkgtype(kind: "executable")) and cannot be imported. It is only the entry point: its moon.pkg imports the dispatcher cli/dispatch, which holds the behaviour described below, and the process helpers:

import {
  "Luna-Flow/floating-tools/cli/dispatch",
  "moonbitlang/core/env",
  "moonbitlang/x/sys",
}

To run a corpus from your own MoonBit code, import a runner such as cli/gda_expr_cli and call its run, or call a frontend directly.

Command line

floating-conformance --backend <gda|testfloat|mpfr|itl> [backend options]
floating-conformance --help
ArgumentMeaning
--backend NAME, --backend=NAMEselects the runner; required, non-empty, at most once (an empty --backend= is an error)
--help, -hprints the usage line and exits with 0 when reached, even after --backend (the runners’ own --help is therefore not reachable through the dispatcher)
anything elseforwarded, in order, to the runner

Arguments are scanned from left to right and the first error ends the scan: --backend without a value, or a second --backend, exits with 2 before a later --help is seen. The value after --backend is taken as is, so --backend --help asks for a backend named --help (exit 2). An empty --backend= is the error --backend requires a value (exit 2), or the at-most-once error when a backend was already given.

The runner receives the program name followed by the forwarded arguments and interprets them as documented in gda_expr_cli, testfloat_expr_cli, mpfr_expr_cli and itl_expr_cli.

Exit status

CodeMeaning
0--help, or the runner reported success
1the runner found failing cases; for itl also diagnostic cases; with --strict-supported (gda, itl) also unsupported cases, and for gda legacy ones
2a missing, repeated or unknown --backend, or a runner usage, file or parse error

Messages go to standard output.

Build

The executable is built by the conformance tooling:

just conformance build decimal_gda    # or binary, interval
sh tools/run_moon_clean_exec.sh run --release --target native tooling/src/cli -- --help

tools/conformance_cli.py builds tooling/src/cli once per backend into _build/conformance/<backend>/ and copies it to <backend>-conformance.exe, so parallel builds for different backends do not share a target directory.

Complete public interface

The package exports no MoonBit items.

// Generated using `moon info`, DON'T EDIT IT
package "Luna-Flow/floating-tools/cli"

// Values

// Errors

// Types and methods

// Type aliases

// Traits