/** * @module edict-lang/browser-full * * Edict Browser Full API — the complete pipeline including compilation and execution. * * Re-exports everything from `edict-lang/browser` (phases 1–3, lint, patch, compose) * and adds: * - Phase 4: Contract verification via Z3 (requires `initEdictBrowser()` first) * - Phase 5: WASM compilation via pure-JS encoder * - Phase 6: WASM execution via the browser WebAssembly API * * Quick start: * 1. Call `initEdictBrowser()` once (loads Z3 WASM, ~1-2s) * 2. Call `compileBrowserFull(ast)` to compile an Edict program * 3. Call `runBrowserDirect(wasm)` to execute the resulting WASM * * For environments where Z3 is not available, use `compileBrowser(ast)` which * skips contract verification (phase 4). */ export * from "./browser.js"; export { contractVerify, contractVerifySync, clearVerificationCache } from "./contracts/verify.js"; export type { ContractVerifyResult, ContractVerifyOptions } from "./contracts/verify.js"; export { getZ3, getSolver, resetZ3 } from "./contracts/z3-context.js"; export { checkBrowserFull } from "./check-browser-full.js"; export type { CheckBrowserFullResult, CheckBrowserFullSuccess, CheckBrowserFullFailure } from "./check-browser-full.js"; export { createBuiltinSolver } from "./contracts/solver/index.js"; export type { SolverContext } from "./contracts/solver-context.js"; export { compile } from "./codegen/codegen.js"; export type { CompileResult, CompileSuccess, CompileFailure, CompileOptions, } from "./codegen/codegen.js"; export { runBrowserDirect, runBrowser } from "./codegen/browser-runner.js"; export type { BrowserRunLimits } from "./codegen/browser-runner.js"; export type { RunResult } from "./codegen/runner.js"; export { wasmInstantiate } from "./codegen/wasm-interpreter.js"; export type { WasmInstance, WasmInterpreterResult, WasmInterpreterOptions } from "./codegen/wasm-interpreter.js"; export type { EdictHostAdapter } from "./codegen/host-adapter.js"; export { BrowserHostAdapter } from "./codegen/browser-host-adapter.js"; export type { BrowserHostAdapterOptions } from "./codegen/browser-host-adapter.js"; export { EdictOomError } from "./builtins/host-helpers.js"; import type { StructuredError, AnalysisDiagnostic, VerificationCoverage } from "./errors/structured-errors.js"; import type { EdictModule } from "./ast/nodes.js"; import type { TypedModuleInfo } from "./checker/check.js"; /** * Initialize the Edict browser compiler. * * This must be called once before using `compileBrowserFull()`. It loads Z3's * WASM binary (~34MB) and initializes the theorem prover. Subsequent calls * are no-ops. * * For Z3 to work in the browser, the consumer must load `z3-built.js` before * calling this function. This sets `globalThis.initZ3` which Z3 needs. * * If Z3 initialization fails, `compileBrowserFull()` falls back to * `compileBrowser()` (skipping contract verification). * * @returns `{ ok: true }` on success, `{ ok: false, error }` on failure */ export declare function initEdictBrowser(): Promise<{ ok: boolean; error?: string; }>; /** * Check if Z3 has been initialized for contract verification. */ export declare function isZ3Initialized(): boolean; /** Result of a browser compilation (phases 1-3/5 + compile). */ export interface CompileBrowserResult { ok: boolean; /** WASM bytes (only when ok === true) */ wasm?: Uint8Array; errors: StructuredError[]; /** Validated module AST (only when ok === true) */ module?: EdictModule; /** Inferred type information */ typeInfo?: TypedModuleInfo; /** Analysis diagnostics */ diagnostics?: AnalysisDiagnostic[]; } /** Result of a full browser compilation (with contract verification). */ export interface CompileBrowserFullResult extends CompileBrowserResult { /** Z3 verification coverage (only when Z3 is initialized) */ coverage?: VerificationCoverage; } /** * Full browser pipeline: validate → resolve → typeCheck → effectCheck → contractVerify → compile. * * Reuses the existing `check()` pipeline (no duplication). If Z3 is not * initialized, falls back to `compileBrowser()` (skips contract verification). * * @param ast - Any JSON value to compile * @returns `{ ok, wasm?, errors, module?, typeInfo?, diagnostics?, coverage? }` */ export declare function compileBrowserFull(ast: unknown): Promise; /** * Browser pipeline without contract verification: * validate → resolve → typeCheck → effectCheck → compile. * * Reuses `checkBrowser()` (no duplication). Does not require Z3. * * @param ast - Any JSON value to compile * @returns `{ ok, wasm?, errors, module?, typeInfo?, diagnostics? }` */ export declare function compileBrowser(ast: unknown): CompileBrowserResult; /** Result of interpreted WASM execution. */ export interface InterpretedRunResult { output: string; exitCode: number; returnValue?: number; error?: string; } /** * Execute WASM bytes using the pure-JS interpreter with minimal host imports. * * @param wasmBytes - Array of byte values (not Uint8Array, for JSON transport) * @param entryFn - Function name to call (default: "main") * @param maxSteps - Max instructions (default: 10_000_000) * @returns InterpretedRunResult with output, exitCode, returnValue */ export declare function runInterpreted(wasmBytes: number[], entryFn?: string, maxSteps?: number): InterpretedRunResult; //# sourceMappingURL=browser-full.d.ts.map