XS
XS<br>v1.2.24<br>A programming language. Anywhere, anytime, by anyone.<br>One statically-linked binary contains the compiler, the language server, the debugger, the formatter, the linter, the test runner, the profiler, and the package manager. The same source runs unchanged on Linux, macOS, Windows, WASI, iOS, Android, ESP32, and Raspberry Pi.<br>6backends<br>3transpile targets<br>0runtime deps<br>2.9MB binary<br>hero.xscopyresetrun
{- classic recursive fib, memoised -}<br>@memoize fn fib(n) {<br>if n 2 { return n }<br>return fib(n - 1) + fib(n - 2)
println(fib(30)) -- 832040<br>{- classic recursive fib, memoised -}<br>@memoize fn fib(n) {<br>if n
macOS, Linux$curl -fsSL xslang.org/install | sh|copy<br>Windows>irm xslang.org/install.ps1 | iexcopy<br>Source$git clone github.com/xs-lang0/xs && cd xs && makecopy
Both installers verify the GitHub release against its published SHA-256 sums before running anything. Static binaries with checksums also live at /downloads.<br>Benchmarks<br>startup, hello world3 ms<br>C source (excluding BearSSL)132 KLOC<br>fib(30)<br>xs --jitxs (vm)node 20cpython 3.1331 ms138 ms62 ms71 ms<br>Measured on a Linux x86-64 box, each binary cold from disk, best of three runs. Reproduce with bash tests/bench_backends.sh in the source tree. The JIT and VM numbers come from the same build that ships in releases.<br>Backends<br>xs --interptree-walk interpreter<br>for the REPL and AST-level plugin debugging
xs (default)bytecode VM<br>what normal runs go through
xs --jitregister-allocating JIT<br>x86-64 + aarch64; opcodes outside its set fall back to the VM
xs --emit cC transpiler<br>self-contained C source for any reasonable compiler
xs --emit jsJavaScript transpiler<br>Node or the browser; ships less than xs.wasm if you only need one program
xs.wasmruntime build<br>the same compiler running in a browser; ships a virtual filesystem and behaves like the native binary, so any XS program can be evaluated at runtime. how to embed it.
Read the docs ->Open the playgroundSource on GitHub