Language reference
Look up a language feature, keyword, or operator. For a guided introduction, start with the language tour.
Common lookups
Records · Nullable types and ! · Optional, Result, and ? · Lambdas · Pattern bindings · Async and await
Values and types
- Variables and constants: let, var, const
Declare values, shadow names, and manage resources with use.
- Types, generics, and conversions
Built-in types, type annotations, constraints, and casts.
- Nullable types and suppression: T? and !
Handle null, narrow with patterns, and suppress nullability.
- Literals, tuples, and basic expressions
Write strings, numbers, tuples, default values, and type expressions.
- Collections and spread
Create collections and spread elements into them.
- Expressions and type inference
How expressions produce values and acquire their types.
- Operators, precedence, and ranges
Look up operator order, indexing, arithmetic, and comparisons.
Functions and calls
- Functions: func
Declare functions, return values, and capture local state.
- Lambdas and function values
Write anonymous functions and pass behavior as a value.
- Calls and arguments
Invoke functions and methods with positional or named arguments.
- Parameters, overloads, and custom operators
Define signatures and choose among overloads.
- Delegates
Declare callable .NET types.
- Pipes
Pass a value through a sequence of calls.
Data models and members
- Classes, structs, and members
Choose an object-oriented type and find its member rules.
- Declarations, constructors, and access
Initialize types, declare fields, and control visibility.
- Records
Declare data types with record semantics.
- Unions
Model alternatives with case-specific payloads.
- Enums
Declare named constant values.
- Interfaces
Define contracts implemented by types.
- Properties, indexers, and events
Declare storage and computed properties, indexers, and events.
- Inheritance, sealed hierarchies, and partial types
Extend types, override members, and define closed hierarchies.
- Extension members
Add members to existing types.
- Object creation and copying
Construct values and copy them with changes.
Patterns and matching
- Pattern matching overview
Test values and bind their parts.
- Match expressions and statements
Write match arms and guards.
- Binding, type, and comparison patterns
Match constants, types, ranges, and comparisons; capture with let.
- Sequence and property patterns
Match collections and object properties.
- Deconstruction and union-case patterns
Match positional values and union payloads.
- Dictionary patterns
Match keys and values in dictionaries.
- Exhaustiveness
Understand missing cases and complete matches.
Control flow, async, and errors
- Control flow overview
Choose a branch, loop, or transfer of control.
- Conditionals and loops: if, for, while
Branch on conditions and iterate over values.
- Assignments and expression statements
Update storage and use expressions as statements.
- Return and yield
Return from functions and produce iterator values.
- Break, continue, and labels
Control iteration and jump to labels.
- Async and await
Declare asynchronous functions and await work.
- Exceptions: try, catch, finally
Throw exceptions and handle them with structured blocks.
- Optional, Result, and propagation: ?
Capture exceptions as values and propagate absence or errors.
Files and syntax
- Source text, keywords, and comments
Read token, identifier, comment, and trivia rules.
- Values, expressions, and statements
Understand the basic parts of a Raven program.
- Namespaces and imports
Organize names and import types or members.
- Top-level code and Main
Start an executable and organize file-level code.
- Grammar
Consult the non-normative EBNF syntax grammar.
Macros
- Macros and compile-time syntax
Expand syntax and use attached or freestanding macros.
Memory and .NET interop
- Systems programming overview
Find memory and low-level programming features.
- Spans and stack allocation
Work with spans and stack-allocated memory.
- Ref structs and ref safety
Understand references, lifetimes, and escape restrictions.
- Unsafe code and native interop
Use pointers and call native code.
- .NET representation and compatibility
See how Raven constructs map to the CLR.
No matching topics. Try a shorter term, another name, or use the site search for full-text results.
About this reference
These articles describe Raven's syntax and semantics. Examples explain the rules; the EBNF grammar provides a complementary syntax view. See release status when using a published SDK with newer documentation. Compiler architecture and implementation work are covered in the contributor documentation.