The toolkit provides the toc executable and an injectable command runner. It reads formal-language models, runs them through the in-process engine, and prints an answer or an explicit unfinished result. The commands are run, run-many, operate, analyze, simplify, convert, decide, check, batch compare and three debug commands.
Run these from the repository root. The installed package also provides the toc executable.
pnpm build
node dist/cli/main.js --help
node dist/cli/main.js run test/cli/fixtures/ends-01.regex --word 101
node dist/cli/main.js decide equivalence test/cli/fixtures/balanced.cfg \
test/cli/fixtures/renamed.cfg --format json --time inf
node dist/cli/main.js debug ir test/cli/fixtures/ends-01.regex --as nfa
The command grammar is as follows.
toc run <model> [--word <text>]
toc run-many <model> <words>
toc operate <operation> <model>...
toc analyze <model>
toc simplify <model>
toc convert <model> (--list | --to <translation>) [--out <file>]
toc decide <question> <model>... [--word <text>] [--alphabet <symbols>] [--witness <policy>] [--trace]
toc check <certificate>
toc batch compare <pairs> --out <file> [--witness <policy>]
toc debug ir <model> --as <form> [--length <n>]
toc debug screen <question> <model>... [--word <text>] [--alphabet <symbols>]
toc debug run <procedure> <question> <model>... [--word <text>] [--alphabet <symbols>]
toc help [command]
The four engine commands accept the existing --kind, --format text|json, --fuel, --time and --limit options. Use - for one standard input source. A notation model on standard input needs --kind. Models JSON identifies its own kind. An invocation can read at most one operand from standard input.
operate takes union, concat, intersection, difference, right-quotient, left-quotient or shuffle-regular with two models. Quotients and shuffle take the regular model second. It takes star, complement, reverse or prefix-closure with one model. homomorphism and inverse-homomorphism take one model followed by a JSON map file. The map has symbol keys and arrays of image tokens as values. An empty array erases a symbol. JSON output contains the engine's target, plan and construction trace. Text output names the operation and target kind.
node dist/cli/main.js operate union test/cli/fixtures/ends-01.regex \
test/cli/fixtures/even-ones.regex --format json
analyze reports grammar properties and finiteness. Text output names the finiteness result, and JSON output contains the complete analysis.
node dist/cli/main.js analyze test/cli/fixtures/balanced.cfg --format json
simplify runs the grammar readability search. Text output names the target kind, and JSON output contains the target, steps, notes and readability measurements.
node dist/cli/main.js simplify test/cli/fixtures/balanced.cfg --format json
run-many reads one word per line in order. A blank line is the empty word, an empty file has no words, and a final line ending adds no extra word. Each line uses the same token quoting as run --word. Text output gives one status per word. JSON output contains the ordered statuses and any batch exhaustion.
printf '101\n10\n\n' | node dist/cli/main.js run-many \
test/cli/fixtures/ends-01.regex - --format json
These commands keep the existing exit codes. A complete result exits 0, an exhausted computation exits 1, invalid arguments exit 2, invalid input exits 3, a host failure exits 5 and cancellation exits 130. A rejected word is a complete result. A batch with an exhausted word exits 1 even when the batch itself finishes.