HOW / RUN, TEST, EMBED
Run, test and embed
Move from a source expression to a working program on your device.
Begin with a program you can inspect.
Open a complete workflow or a small syntax example. Edit the source and press Run. The page sends the displayed source to a compiler in a local worker, then shows the returned console output and any supported visual result.
Changing the source clears the previous result. Run again to calculate from the new expression. The browser preview is experimental; errors are displayed in the same output area.
This preview runs the frozen browser compiler in its embedded examples and offers no downloadable packages. Read the preview availability status; no compiler, native, Node, SDK or embedding-starter package is offered here. Browser examples do not qualify native or Node execution.
Use the command line for a native workflow.
A compatible native compiler supplies the vkf command. The availability page records this preview’s scope; no native package is offered here.
vkf -v
vkf -e ':: 2 + 2'
vkf model.vkf
vkf -b model.vkf -o model
./model| Command | Purpose |
|---|---|
vkf model.vkf | Build when needed and execute the program |
vkf -b model.vkf -o model | Build an executable without running it |
vkf -e ':: 2 + 2' | Evaluate source supplied as an argument |
vkf -t tests.vkf | Run discovered tests in a source file |
vkf -t tests | Run tests from a directory |
vkf -v | Inspect the compiler version |
These command forms come from the source driver. Native target support requires its own package and qualification; none is offered by this preview. The table does not promise cross-compilation.
Keep a relationship you can check.
A model has useful invariants before it has a large dataset. This small assertion program checks the endpoints and midpoint of a smooth path. Change an expected value to see a failure.
Expected result · 0.7.5 preview
passed
Browser Run executes this source directly. Native test discovery is a separate CLI path, invoked with vkf -t.
Compile source in a WebAssembly worker.
The browser package contains a compiler module, WASM binary and data archive. The worker compiles VKF source into program WASM and execution metadata. Console programs execute in the worker. Retained visual programs execute in the renderer window against real DOM owners, then return retained-scene packets to the view component. Long-running retained-program cancellation remains unqualified in this candidate.
Use the runner and runtime files from the same package. createInlineRunner().run(source) handles the worker-facing path. Pass the matching {moduleURL, wasmUrl, dataURL} to createInlineRunner. The packaged runner also provides the paired window dispatcher required by retained visual programs. This guide does not imply a public vkf --wasm CLI flag.
Connect a page input to the calculation.
Open the working HTML example. Its form supplies a number, creates a VKF call, executes it in the worker and displays stdout. The form runs on this site; an embedding-starter package is not offered in this preview.
import {createInlineRunner} from "./inline-runner.mjs";
const release = await fetch("./current-compiler-release.json").then(r => r.json());
const runner = createInlineRunner({
moduleURL: release.package.module,
wasmUrl: release.package.wasm,
dataURL: release.package.data
});
const output = document.body.appendChild(document.createElement("pre"));
const result = await runner.run("square(x):x^2\n::square(5)");
output.textContent = result.output.stdout;Keep user input typed and validated before inserting it into source. The embedded form accepts a finite number, clears stale output on edits and prevents overlapping submissions. The calculation itself runs through VKF.
Serve the complete bundle together.
The following hosting notes describe the embedded runtime. This preview supplies no downloadable bundle. A compatible integration needs matching runtime files, relative paths and third-party notices; public hosting needs HTTPS.
python3 -m http.server 8000Shared-memory execution needs browser isolation. A host can send Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp. The included isolation helper can establish the required policy through a service worker on compatible hosts and may reload the page once.
Keep the worker, WASM and data files under the same origin unless the host is deliberately configured for cross-origin isolation. Preview availability →