EZ-language

EZ Language Specification

1. Lexical Structure

Keywords

The following identifiers are reserved words: task, give, when, other, while, repeat, get, escape, skip, model, init, self, hidden, shown, extends, out, in, try, catch, throw, use, to, true, false, nil.

Operators

Literals

2. Grammar

Statements

Program consists of a sequence of statements.

program      ::= statement*
statement    ::= declaration | expression_stmt | control_flow
declaration  ::= var_decl | task_decl | model_decl

Control Flow

EZ uses when for conditionals.

when condition {
    body
} other when condition2 {
    body
} other {
    body
}

Loops include while, repeat, and get.

# Standard While
while condition { ... }

# Range Loop (inclusive)
repeat var = start to end { ... }

# Collection Iterator
get item in collection { ... }

Functions

Declared with task. Implicit returns are not supported; use give.

task name(p1, p2) {
    ...
    give value
}

Classes (Models)

Declared with model.

model Name extends Parent {
    hidden privateVar
    shown publicVar
    
    init(args) { ... }
    
    task method() { ... }
}

3. Type System

EZ is dynamically typed. Value types include: