Playground
Run Nex code in the browser. No install, no setup.
The playground runs the same tree-walking interpreter that powers nex run — compiled to JavaScript via Scala.js and loaded lazily into the page on first click. Single-file programs only; the playground bypasses the module loader so there’s no filesystem dependency, no Node assumption.
Click Run to execute. The first run loads the interpreter bundle (~1.8 MB minified, ~400 KB over compression), so it takes a second; subsequent runs reuse the cached bundle and finish in milliseconds.
Hello
Arrays and HOFs
Complex numbers
A tiny FFT (recursive, N = 4)
Limitations
- Single-file programs only. The playground bypasses the module loader;
importwon’t work here. Use multipledefs in the same buffer. - No file I/O, no stdin. Output is whatever
print(...)produces. - No
nex compilepath. This runs the interpreter; the AOT compile path needsclangand is JVM-only. - Real precision. Numbers print with Java’s
Double.toStringshortest-round-trip here (matching the JVM interpreter exactly). The AOT binary uses an iterative shortest-round-trip helper that converges to the same byte sequence — see the Verification chapter for the parity contract.
A polished editor (CodeMirror + Nex syntax highlighting) is on the roadmap; the current textarea is intentionally minimal to validate the experience first.