A small, statically typed language that feels like Python and runs like C. One command compiles and runs your program in milliseconds, as a native Linux executable or as a single web page.
curl -fsSL https://sloppy-lang.org/install | bash
pos = vec2(400, 300)
update = (dt: f64):
pos += input_axis() * f32(300 * dt)
draw = ():
clear(rgb(0.08, 0.08, 0.12))
circle(pos, 24, rgb(1.0, 0.6, 0.2))
text("arrow keys", vec2(20, 20), 24, WHITE)About 250,000 lines a second. Hello world compiles and runs in about 10 ms; there is no build system, options live in the source.
Release builds run within about 1.5× of gcc -O2, with bounds checks on. parallel_map uses every core; GPU arrays run on the GPU.
Type inference everywhere, indentation syntax, closures, partial application, generics without ceremony, unions, value semantics with no garbage collector.
Windows, input, 2D drawing, a 3D renderer with shadows and bloom, shaders written in Sloppy, audio, pixel art and any screen shape, all built in.
Native programs are static executables with no dependencies; web builds are one HTML file. Graphics drivers are optional: there is a software renderer.
The compiler is written in Sloppy and compiles itself, even in this site's playground, where it runs as WebAssembly.
fib = (n: int) -> int:
if n < 2: return n
fib(n - 1) + fib(n - 2)
nums = [5 3 9 1]
nums.sort()
add = (a: int, b: int): a + b
print(nums.map((x): x * x), add(1, _)(41), fib(30))
print(nums .* 2.5 .+ 1, sqrt.([4.0 9.0]), [1 2; 3 4] * [1 0; 0 1])
Editors: sloppy lsp is a language server (and there is a VS Code / Cursor extension). An interactive prompt: run sloppy with no file.