Tyrus is a programming language that combines TypeScript-like syntax with Rust-like semantics, designed for building resilient backend services, CLI tools, and systems software. The language compiles to native binaries using LLVM with a runtime included in the executable.

Core language features

Tyrus uses concise syntax in .tyr files with native execution and deterministic memory semantics. The type system includes integers u8..u128, i8..i128, floats f32..f128, decimal, boolean, string, char, and first-class Result types. Memory safety comes without a garbage collector—Non-Copy types move on assignment, and borrows are verified at compile time with Non-Lexical Lifetimes (NLL) that expire after last actual use.

Error handling and control flow

The language provides exhaustive pattern matching on tagged unions and algebraic enums, with guard clauses ensuring every variant is handled. Error handling uses Result with both Ok and Err variants matchable at the call site. The onfail attachment lets error handlers see the error while maintaining the success binding. A bare return produces absence, propagated safely with ?. and ?? operators.

Productivity features

The pipe operator |> threads values through function chains, while the % topic token places the piped value exactly where needed without intermediate variables. Native async/await supports Promise return types. Compile-time evaluation with comptime executes functions during embedding results as static scalars. Scope-based cleanup uses defer for normal exit and errdefer for error rollback paths.

Tooling and ecosystem

Tyrus includes a full toolchain: tyrus repl for interactive LLVM JIT evaluation, tyrus dev for live reload, tyrus fmt for zero-config formatting, and tyrus lint for style, correctness, safety, performance, and architecture rules. Language server protocol support covers VS Code, Neovim, Zed, IntelliJ, and Kate. A Web Playground at playground.tyruslang.org lets users write, compile to WebAssembly, and run code with shareable links.

Security and deployment

Production secret protection encrypts .env files into target//.env.sealed with asymmetric keys and binary fingerprints, preventing plaintext secrets in containers. The compiler mirrors keys and cleared values into .env.example. Typed ORM and ODM support relational databases and MongoDB with recoverable failures returned as Result. High-performance numeric kernels provide algebraicAdd, algebraicSub, algebraicMul, algebraicDiv, and algebraicRem with compiler permission for fast-math reassociation and SIMD vectorization.

Naming origin

The name Tyrus combines the initials of TypeScript and Rust. It also references Tyre, the Phoenician city meaning "rock," and Tyr, the Norse god of war, justice, and courage.