XU XUv0.16.0

EBNF

Planning grammar (for review, not a byte-for-byte parser table):

Xu Core Grammar EBNF Specification
Grammar Rule Production Syntax (Definition) Description & Semantics
File "@" PackagePath { CompileTag } { Import } { Decl } . Root structure of source files starting with a package declaration
Import [ Ident ] "#" Path . Module import; external paths require an alias before #
ReturnStmt "<<" [ Expr ] . Function return statement with optional expression
ThrowStmt ">>" Expr . Throw error or exception propagating upward
ExitStmt "<<<" Expr . Terminate process with exit code
BreakStmt "<-" . Break from loop immediately
ContinueStmt "->" . Advance to next loop iteration
RangeOp ":" . Half-open interval range operator [start, end)
XuStmt "xu" QualifiedName "(" [ Args ] ")" . Spawn lightweight goroutine concurrent invocation
UnsafeBlock "unsafe" Block . Isolate low-level hardware operations (raw pointer dereferencing, assembly, C ABI)
RawPointerType "*raw" Type . Raw pointer declaration supporting address casting and pointer arithmetic
AsmStmt "asm!" "(" StringLit { "," AsmOperand } ")" . Native inline assembly statement with operand bindings and options
Attribute ("#[" Ident [ "(" AttrArg ")" ] "]" | "@repr" "(" StringLit [ "," ReprArg ] ")") . Function attributes (#[no_mangle], #[naked]) and layout controls
Expr … | Expr ">>>" "(" Ident ")" Block | Expr ">>>" . Expressions, safe error unwrap & propagation
Click to expand Raw EBNF Grammar
File         = "@" PackagePath { CompileTag } { Import } { Decl } .
CompileTag   = "$" ("freestanding" | "macos" | "linux" | "windows" | Ident) .
Import       = [ Ident ] "#" Path  .
ReturnStmt   = "<<" [ Expr ] .
ThrowStmt    = ">>" Expr .
ExitStmt     = "<<<" Expr .
BreakStmt    = "<-" .
ContinueStmt = "->" .
RangeOp      = ":" . // [start, end)
XuStmt       = "xu" QualifiedName "(" [ Args ] ")" .
UnsafeBlock  = "unsafe" Block .
AsmStmt      = "asm!" "(" StringLit { "," AsmOperand } ")" .
RawPointer   = "*raw" Type .
Expr         = … | Expr ">>>" "(" Ident ")" Block | Expr ">>>" .

PackagePath is a slash path, optionally quoted for domain-based identities. Dots in domain names are preserved. An import alias precedes #; external paths require an alias.