A language that
you can use anywhere, anytime.
XS is a fast, expressive language with gradual typing, algebraic effects, and a strong toolchain. Written in C with no dependencies.
$ curl -fsSL xslang.org/install | sh
hello.xs
fn greet(name) {
println("hello, {name}!")
}
-- pattern matching
fn describe(value) {
match value {
0 => "zero"
n if n > 0 => "positive: {n}"
_ => "negative"
}
}
-- algebraic effects
effect Log {
fn log(msg)
}
fn main() {
handle greet("world") {
Log.log(msg) => {
println(msg)
resume(null)
}
}
}Features
Gradual typing
Start untyped, add types where they matter. The type system stays out of your way until you need it.
Algebraic effects
First-class effects for error handling, async, logging, and more. Composable and resumable.
Pattern matching
Deep structural matching with guards, destructuring, ranges, regex, and exhaustiveness checking.
Zero dependencies
The compiler is pure C. No LLVM, no runtime bloat. Builds in seconds.
Multi-target
Transpile to C, JavaScript, or WebAssembly from a single codebase.
Full concurrency
Spawn, async/await, actors, channels, nurseries. Pick the model that fits.
Tooling
Everything you need, built in. No third-party toolchain required.
- -Bytecode VM + JIT compiler
- -LSP with completions and diagnostics
- -DAP debugger
- -Formatter and linter
- -Test runner
- -VSCode extension
- -Plugin system
Concurrency that makes sense
channels.xs
let ch = channel()
spawn {
for i in 0..10 {
ch.send(i)
}
}
for i in 0..10 {
println(ch.recv())
}actors.xs
actor Counter {
var count = 0
fn increment() {
count = count + 1
}
fn get() { return count }
}
let c = spawn Counter
c.increment()
c.increment()
println(c.get()) -- 2Ready to try it?
XS is open source and actively developed.