A strongly-typed language inspired by Perl that compiles to native executables via C.
my str $greeting = "Hello, Strada!"; my array @numbers = [1, 2, 3, 4, 5]; foreach my int $n (@numbers) { say($greeting . " Number: " . $n); }
Combining Perl's expressiveness with strong typing and native performance.
Compiles to C, then to native machine code via GCC. No VM overhead in production.
Catch errors at compile time with explicit types: int, num, str, array, hash, and more.
Familiar sigils ($, @, %), expressive string handling, and powerful regex support.
The Strada compiler is written in Strada itself, demonstrating the language's capabilities.
Declarative OOP with has, extends, with, and method modifiers (before/after/around). Auto-generated constructors and accessors.
Includes Cannoli, a built-in web framework with routing, file uploads, chunked responses, and SSL/TLS support.
Embed C code directly with __C__ blocks. Create and import shared libraries (.so) with import_lib.
Anonymous functions with automatic variable capture. Pass functions as values.
Modern try/catch/throw for robust error handling. Clean exception propagation.
Built-in ssl:: module for secure networking with OpenSSL. Full TLS 1.3 support.
Built-in profiler with -p flag shows call counts and timing for performance analysis.
Accept variable arguments with ...@param syntax. Spread operator unpacks arrays at call sites.
First-class async/await with thread pool. async::all(), async::race(), timeouts, and cancellation.
Tree-walking interpreter for interactive REPL, quick scripts, and embedded eval — no C compiler needed at runtime.
Document your code with POD (Plain Old Documentation). Generate HTML docs with the stradadoc tool.
Perl-style array transformations with $_ and blocks. Create lookup hashes with map { $_ => 1 }.
Strada is its own language, but if you know Perl, you'll feel right at home.
Strada draws heavily from Perl's syntax — sigils, regular expressions, hashes, Moose-style OOP — and compiles it all to C and then to native machine code. The result is a single binary with no interpreter, no VM, and no runtime dependencies.
Sigils ($, @, %), regex (=~, s///), foreach, map, grep, push/pop — the idioms you know from Perl work in Strada with the addition of strong typing.
The included perl2strada tool translates Perl scripts and modules to Strada source as a starting point. Port your existing code and start compiling it.
No interpreter dispatch loop, no symbol table lookups, no bytecode overhead. Function calls compile to a single call instruction. Integer arithmetic uses zero heap allocation.
Compile your program once and distribute a standalone native executable. No language runtime required on the target machine.
Coming from Perl? See the Perl integration guide or try perl2strada on your codebase.
Strada compiles to native machine code via GCC. Here's how it compares.
Strong types with Perl-style sigils for clarity.
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
See Strada in action with real-world examples.
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
From source code to native executable in three steps.
The self-hosting compiler is written in Strada and compiles Strada source code to portable C, which is then compiled by GCC to produce fast, native executables with no runtime dependencies beyond the standard C library.
Alternatively, the tree-walking interpreter can execute Strada programs directly from the AST without generating C code — ideal for interactive use and scripting.
Up and running in minutes.
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