Strada is a strongly-typed language inspired by Perl that compiles straight to native executables via C — familiar sigils, optional types, and up to 95× the speed.
func greet($name) { say("Hello, " . $name . "!"); } func sum_all { my $total = 0; foreach (@_) { $total += $_; } return $total; } greet("Strada"); say(sum_all(1, 2, 3, 4, 5)); # 15
Perl's idioms with optional type annotations, compiled to native machine code. No VM, no interpreter overhead in production.
Compiles to portable C, then to native machine code via GCC. Function calls become a single call instruction; integer arithmetic uses zero heap allocation. No VM overhead in production.
.strada → .c → native binary
Add types when you want clarity (int, num, str, array, hash), or omit them for quick scripting. The sigil tells the compiler the rest.
Familiar sigils ($, @, %), expressive string handling, and powerful regex support — the idioms you already reach for.
The Strada compiler is written in Strada itself — proof the language can carry real, serious work.
Refcounting with a built-in cycle collector and request arena (default-on). Reclaims cycles with no manual weaken(). Designed valgrind-clean.
Declarative OOP with has, extends, with, and before/after/around modifiers. Auto-generated constructors and accessors.
Ships with Cannoli — routing, file uploads, chunked responses, and SSL/TLS, built in.
Embed C with __C__ blocks. Precompile with strada -M; consumers just use Foo; and the .o links automatically.
First-class async/await on a thread pool. async::all(), async::race(), timeouts, and cancellation.
Modern try/catch/throw for robust error handling with clean propagation.
Anonymous functions with automatic variable capture. Pass functions around as values.
Interactive REPL via strada-jit — real native compilation through tcc or gcc + dlopen. strada --script runs files whole-file.
Function profiler (-p) and line-level profiler (--full-profile) with text and HTML report tools.
Perl-style array transforms with $_ and blocks. Build lookup hashes with map { $_ => 1 }.
Strada draws heavily from Perl — sigils, regex, hashes, Moose-style OOP — and compiles it all to a single native binary with no interpreter, no VM, and no runtime dependencies.
Sigils ($, @, %), regex (=~, s///), foreach, map, grep, push/pop — the idioms you know, with optional types for clarity.
Rather keep writing Perl? perla is a Perl 5 compiler built on Strada — Perl source straight to native code, no rewriting.
No interpreter dispatch loop, no symbol-table lookups, no bytecode overhead. Function calls compile to a single call; integer math allocates nothing.
Compile once, ship a standalone native executable. No language runtime required on the target machine.
Coming from Perl? See the Perl integration guide →
Strada compiles to native machine code via GCC. Here's how it stacks up against Perl 5.38.
Annotate when you want the clarity. Omit them when you want to move fast.
64-bit integers (tagged, zero alloc)
Floating-point numbers
UTF-8 strings
Dynamic arrays
Key-value maps
Generic type
Scalar sigil
Array sigil
Hash sigil
Real syntax, real programs — from hello world to a web server.
func main() int { say("Hello, World!"); return 0; }
my int $count = 42; my num $price = 19.99; my str $name = "Strada"; my array @items = [1, 2, 3]; my hash %config = { "host" => "localhost", "port" => 8080 };
func factorial(int $n) int { if ($n <= 1) { return 1; } return $n * factorial($n - 1); } say(factorial(10)); # 3628800
# Accept variable number of args func sum(int ...@nums) int { my int $total = 0; foreach my int $n (@nums) { $total = $total + $n; } return $total; } sum(1, 2, 3, 4, 5); # 15 # Spread operator unpacks arrays my array @vals = [10, 20, 30]; sum(...@vals); # 60 sum(1, ...@vals, 99); # 160
package Animal; has ro str $species (required); has rw int $energy = 100; package Dog; extends Animal; has ro str $name (required); before "bark" func(scalar $self) void { say("[get ready]"); } func bark(scalar $self) void { say($self->name() . " barks!"); } my scalar $d = Dog::new("name", "Rex", "species", "dog"); $d->bark(); # [get ready] / Rex barks!
func make_counter() scalar { my int $count = 0; return func () { $count++; return $count; }; } my scalar $counter = make_counter(); say($counter->()); # 1 say($counter->()); # 2
func divide(int $a, int $b) int { if ($b == 0) { throw "Division by zero"; } return $a / $b; } try { my int $result = divide(10, 0); } catch ($e) { say("Error: " . $e); }
func handle(scalar $c) hash { my str $path = $c->path(); if ($path eq "/") { return $c->json({ "message" => "Welcome to Strada!" }); } return $c->not_found(); }
func main(int $argc, array @argv) int { if ($argc < 2) { say("Usage: " . $argv[0] . " <name>"); return 1; } say("Hello, " . $argv[1] . "!"); return 0; }
__C__ { #include <math.h> } func fast_sqrt(num $x) num { __C__ { double val = strada_to_num(x); return strada_new_num(sqrt(val)); } } say(fast_sqrt(16.0)); # 4.0
The self-hosting compiler is written in Strada and compiles to portable C, which GCC turns into fast native executables with no runtime dependencies beyond libc.
For interactive use, strada --repl opens a JIT-backed REPL (tcc or gcc + dlopen) supporting the full language. A standalone tree-walking / bytecode VM interpreter is also available as an opt-in build for embedding.
Get the source code from GitHub.
git clone https://github.com/strada-lang/strada-lang.git && cd strada-lang
Detect dependencies and build the compiler.
./configure && make
Create hello.strada with your favorite editor.
func main() int {
say("Hello, Strada!");
return 0;
}
Use the Strada compiler to build and execute.
./strada -r hello.strada