Table of Contents

Raven language reference

Raven is an expression-oriented language for .NET. It combines concise functions and immutable data with classes, pattern matching, async programming, and direct access to the .NET ecosystem.

import System.*

record Temperature(Celsius: double)

func describe(value: Temperature) -> string {
    value.Celsius match {
        ..<0 => "freezing"
        0..<20 => "cold"
        20..<30 => "comfortable"
        _ => "hot"
    }
}

let reading = Temperature(21.5)
Console.WriteLine(describe(reading))

This reference explains Raven by feature: what a construct is for, how to use it, and the rules that matter when code becomes more involved. It serves both as developer documentation and as Raven's working language specification.

The reference is precise where a distinction affects normal programs, .NET interoperability, or compiler diagnostics. It does not attempt to enumerate every compiler implementation detail or every possible invalid program.

Where to start

If you are new to Raven, begin with Values, expressions, and statements, Functions, and Unions. Together they introduce Raven's expression-oriented style, callable values, records, unions, and the unit value.

If you already use C# or another .NET language, start with the Type system, Classes, structs, and interfaces, and .NET implementation notes. These pages show where Raven follows the CLR model and where its source-language conventions differ.

For a formal view of the syntax, see the non-normative EBNF grammar. Contextual and semantic rules remain in the feature articles.

Language fundamentals

Learn how Raven source is written and organized, how values and statements behave, and how an executable program starts.

Types

Explore Raven's built-in and .NET types, nullability, tuples, function types, unions, enums, and delegates. Unions remain a distinct feature because their closed alternatives, payloads, and exhaustiveness rules form a complete data-modeling construct rather than merely another annotation syntax.

Expressions

Expressions produce values. These articles cover inference, literals, calls, collections, tuples, pipelines, construction, and operators.

Declarations and members

Define local values, reusable functions, and object-oriented types. These pages also cover generic constraints, overloads, properties, events, inheritance, and extension members.

Pattern matching

Pattern matching tests the shape and contents of a value while optionally binding its parts. Raven supports constants, ranges, types, sequences, properties, dictionaries, union cases, and nested combinations of patterns.

Control flow and errors

Branch, iterate, return, yield, jump, synchronize, and represent failure either as an exception or as an explicit carrier value.

Metaprogramming

Raven macros transform syntax at compile time and can provide domain-specific language forms while remaining integrated with the compiler.

Systems programming and .NET interoperability

Use spans, stack allocation, managed references, pointers, unsafe code, and external declarations when working close to memory or a native boundary. The implementation notes describe how Raven concepts are represented on .NET.