Language Reference
This section provides a comprehensive reference for the Strata programming language.
Overview
Strata is a statically typed programming language. This reference covers all language features.
Table of Contents
Language Basics
- Variables - Variable declarations and scoping
- Types - Type system, primitives, nullable, unions
- Functions - Function definitions, parameters, return types
- Control Flow - if/else, loops, match expressions
Object Oriented Design
- Classes - Classes, inheritance, properties, methods
- Interfaces & Traits - Interfaces and traits
- Generics - Generic type parameters
Project Structure
- File Structure - Top-level code rules
- Imports - Importing modules and symbols
Standard Library
- Overview - Library structure
- Numbers - Integer and Float methods
- Strings - String manipulation
- Arrays - Array operations
- Associative Arrays - Maps and Dictionaries
- Input & Output - Console and File I/O
Advanced
- Error Handling - Result types, try-catch
- PHP Interoperability - Using PHP features
- Code Guidelines - Coding standards
Core Principles
Strata follows these core principles:
- Safety by default: All errors must be handled
- Explicitness over magic: No implicit behavior
- Strong static typing: Types are checked at compile time
- Tooling-first: Built for great IDE support
Quick Reference
Basic Syntax
strata
// variables
let name: String = "Luna";
let age = 6; // type inferred
// types
type UserId = Int;
// functions
fn greet(name: String): String {
return "Hello, ${name}!";
}
// logic belongs in functions (e.g. main)
fn main(): Void {
try {
let result = loadUser(id: 1);
print(result.unwrap().name);
} catch (e) {
print("Error: " . e.getMessage());
}
}Explore the language features by clicking on the topics above.