A strongly-typed programming language inspired by Perl that compiles to C for blazing-fast native executables.
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, no interpreter overhead.
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.
Clean object-oriented programming with packages, methods, inheritance via bless().
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.
Strong types with Perl-style sigils for clarity.
64-bit integers
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
package Dog; func new(str $name) scalar { my hash %self = { "name" => $name }; return bless(\%self, "Dog"); } func speak(scalar $self) void { say($self->{"name"} . " says woof!"); } my scalar $dog = Dog::new("Rex"); $dog->speak(); # Rex says woof!
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.
Up and running in minutes.
Get the source code from GitHub.
git clone https://github.com/strada-lang/strada-lang.git && cd strada-lang
Compile the self-hosting Strada compiler.
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