Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Korrin language specification

This is the normative description of Korrin: if the implementation disagrees with a statement here, one of them is a bug. It describes the language as of Milestone 1.

Nothing here is speculative — features not yet implemented are not described. Every runnable example is executed by CI against the implementation.

#Section
01Lexical structure
02Grammar
03Values and types
04Expressions
05Statements
06Functions
07Classes
08Built-in functions and methods
09Errors and diagnostics
10Execution model

Conventions

  • Grammar fragments use the notation defined in section 02, which also gives the complete grammar.

  • A fenced code block tagged korrin is an example. Blocks that also carry an expected-output comment are executed by CI (crates/korrin/tests/spec.rs) and must produce exactly that output. The convention:

    ```korrin
    print(1 + 2)
    # => 3
    ```
    

    A # => line states the next line of expected standard output. A # error: E0304 line states that the program must fail with that code.

  • "must", "must not", and "may" are used in the RFC 2119 sense.