Builds MYSTRAN into WebAssembly and provides:
- reproducible fetch/build scripts
- quick smoke and full benchmark-deck smoke validation
- an ESM JavaScript library (
src/web_mystran.js,src/mystran_input.js,src/output_parser.js)
- Docker (or compatible daemon)
- Node.js 18+
- PowerShell (Windows helper scripts)
powershell -File scripts/fetch_deps.ps1powershell -File scripts/build.ps1node tools/smoke_test.js
For full benchmark-deck smoke checks:
powershell -File scripts/smoke_test.ps1
npm run fetch-depsnpm run buildnpm run smoke(library-level smoke)npm run smoke:full(full deck smoke)
If PowerShell blocks npm.ps1 by execution policy, run npm.cmd instead (for example: npm.cmd run smoke).
dist/mystran.js(ES module,MODULARIZE=1,EXPORT_ES6=1)dist/mystran.wasmsources/MYSTRAN_native_ref/Binaries/mystran(native Linux reference binary for smoke compare)
./index.js->WebMYSTRAN,MystranInput,parseMystranOutput./src/web_mystran.js->WebMYSTRAN./src/mystran_input.js->MystranInput./src/output_parser.js->parseMystranOutput
static async load(options?) -> Promise<WebMYSTRAN>static input(lines?) -> MystranInputstatic Input(alias forMystranInput)input(lines?) -> MystranInputrun(deckText, options?) -> resultreadOutput(result, extension, encoding?)writeFile(path, data),readFile(path, encoding?),FS,reset(),destroy()
WebMYSTRAN.load(options?) accepts:
moduleUrl: URL/path override fordist/mystran.jswasmUrl: URL/path override fordist/mystran.wasmmoduleFactory: custom emscripten module factory functionexportName: export name when loading frommoduleUrl(defaultWebmystranModule)wasmBinary:Uint8Array/ArrayBuffer/Bufferoverride for wasm bytesworkDir: virtual FS working directory (default/work)onStdout/onStderr: per-line callbacksmoduleOptions/locateFile: forwarded to emscripten module options
run(deckText, options?):
- writes
deckTexttodeckFileName(defaultWEBMYSTRAN.DAT) - executes wasm in-process via ESM module factory
- returns:
raw:{ stdout, stderr, exitCode, signal, timedOut }output: parsed status object fromparseMystranOutput(raw)outputs: discovered result files by extension (F06,OP2, ...)files: artifact metadata{ extension, name, path, size }workDir,deckFileName,deckPath
run(..., options?) options:
deckFileName,workDir,stdinText,argsfiles: array of{ path, data }staged before executionparseOptions: forwarded to parseroutputExtensions: custom extension scan list
Builder for deck text.
add(line | lines[]),addLines(lines)blank(count?),comment(text?)sol(value),cend(),subcase(id)set(key, value),setTitle(value),setSubtitle(value),setLabel(value)beginBulk(),endData()param(name, value),include(path)toArray(),toString()
Parses stdout/stderr into a structured status object:
hasNormalTerminationhasRuntimeAborthasSolverErrorwarningCounterrorCodes,firstErrorCode
import fs from "node:fs";
import { WebMYSTRAN } from "./index.js";
const deck = fs.readFileSync(
"sources/MYSTRAN_Benchmark/Benchmark_Decks/Bush_Bar/bar_01.DAT",
"utf8"
);
const solver = await WebMYSTRAN.load();
const result = solver.run(deck, { deckFileName: "WEBMYSTRAN.DAT" });
if (!result.output.hasNormalTermination) {
throw new Error("MYSTRAN did not terminate normally.");
}
const f06Text = solver.readOutput(result, "F06", "utf8");
console.log(f06Text.slice(0, 400));
solver.destroy();node tools/smoke_test.js- Uses benchmark deck
Bush_Bar/bar_01.DAT - Uses the same per-deck PASS/FAIL line format and final summary format as full smoke
- Runs both wasm and native reference, then checks wasm/native parity for the deck
- Validates:
- process exit code
MYSTRAN terminated normally- no parsed
*ERRORcodes - required output artifacts (
F06,OP2)
scripts/smoke_test.ps1(ornode tools/smoke_test.js full) runs wasm and native reference over selected benchmark decks- Checks:
- per-deck wasm and native run outcomes (timeouts/runtime aborts/process errors)
- required output generation (
F06plus non-empty result artifacts) - wasm/native parity checks (outcome class, termination marker, error code, OP2 presence)
- Reports one terminal line per deck and a final summary line
- Writes no smoke artifacts to host disk (no
smoke_runfolder or host-side deck outputs)
- Source/dependency provenance: SOURCES.md
- Patch inventory: PATCHING.md
- Third-party notices: THIRD_PARTY_NOTICES.md
scripts/build.ps1 forwards:
WEBMYSTRAN_DEBUG_STACKSWEBMYSTRAN_TRACE_MALLOCWEBMYSTRAN_PROFILE_CHECKPOINTS
scripts/smoke_test.ps1 accepts smoke arguments directly.
- Project/package: MIT (LICENSE)
- Upstream MYSTRAN source is MIT (see
sources/MYSTRAN/LICENSE.txt) - Additional notices: THIRD_PARTY_NOTICES.md