3. Modules

Syntax

SourceFile ::=
    ZeroWidthNoBreakingSpace?
    Shebang?
    Module

ZeroWidthNoBreakingSpace ::=
    \u{FEFF}

Shebang ::=
    #! ~[\n]*

Module ::=
    Item*

Item ::=
    MacroItem
    | Statement

MacroItem ::=
    #! MacroInvocations

Examples

#!/usr/bin/env hashc
#![feature(quantum_closures)]

Foo := struct(
    x: i32,
    y: i32 = 0,
)

FooKind := enum(
    Bar,
    Baz,
)

main := () => {
    println("hello world")
}

3.1. Statements

Syntax

Statement ::=
    Expression
    | ;

StatementList ::=
    Statement*