Expr = Expr "?" Expr ":" Expr
| Expr "||" Expr
| Expr "&&" Expr
| Expr in Expr
| Expr "|" Expr
| Expr "^" Expr
| Expr "&" Expr
| Expr "==" Expr
| Expr "!=" Expr
| Expr "===" Expr
| Expr "!==" Expr
| Expr "<" Expr
| Expr ">" Expr
| Expr "<=" Expr
| Expr ">=" Expr
| Expr "<<" Expr
| Expr ">>" Expr
| Expr ">>>" Expr
| Expr "@" Expr
| Expr "+" Expr
| Expr "-" Expr
| Expr "*" Expr
| Expr "/" Expr
| Expr "%" Expr
| "!" Expr
| "+" Expr
| "-" Expr
| "~" Expr
| "#" Expr
| final Expr
| new Expr
| ".+" Expr
| ".*" Expr
| ".&" Expr
| ".^" Expr
| ".|" Expr
| Designator
| INTEGER
| FLOATINGPOINTNUMBER
| CHARACTER
| nil
| "(" Expr ")"
| Call
| "[" ElistPartsList "]"
| tab "[" ElistPartsList "]"
| STRING
| char
| int
| long
| float
| hide
| hideblock
| vec
| tab
| fun
| fiber
| class
| obj
| thread
| type
| this
| char "(" Expr ")"
| int "(" Expr ")"
| float "(" Expr ")"
| vec "(" Expr ["," Expr] ")"
| tab "(" Expr ")"
| type "(" Expr ")"
| AnonHeader FormalParameters Block
| try "(" ExecutiveStmt [ "," ExceptClassList] ")"
| "_"
| "..."
Designator = DesignatorOrCall "[" Expr "]"
| DesignatorOrCall ActualParameters
| DesignatorOrCall "." IDENT
| IDENT
ElistPartsList = [ Expr [ ":" Expr ] {"," Expr [ ":" Expr ] } ]
DesignatorOrCall = Designator
| Call
Call = Designator ActualParameters
ActualParameters = "(" [ Expr { "," Expr } ] ")"
AnonHeader = [Qualifiers] FuncFiberClass
Stmt = ExecutiveStmt
| Declaration
Assign = "="
| "*="
| "/="
| "%="
| "+="
| "-="
| "@="
| "<<="
| ">>="
| ">>>="
| "&="
| "^="
| "|="
Pattern = Expr
ExecutiveStmt = ";"
| Expr ";"
| Designator Assign Expr ";"
| Designator ("++" | "--") ";"
| ("++" | "--") Designator ";"
| if "(" Expr ")" Stmt [ else Stmt ]
| for "(" Stmt ForGuardExpr ";" Stmt ")" Stmt
| for "(" Designator in Expr ")" Stmt
| (pmatch | rmatch) "(" Expr ")" "{" CaseList "}"
| break ";"
| continue ";"
| return [ Expr ] ";"
| throw Expr ";"
| wait "(" Expr ")" Stmt
| BlockStmt
| TryBlockStmt
| C_CODE
ForGuardExpr = [Expr]
CaseList = { case Pattern [CaseCond] ":" StmtList }
CaseCond = if Expr
BlockStmt = Block
TryBlockStmt = try Block { Catch }
Catch = catch "(" ExceptClassList ")" Block
ExceptClassList = Expr { "," Expr }
Declaration = VarDeclarations
| FriendClause
| ExternDeclarations
| FuncClassDeclaration
| SingletonObject
| ForwardDeclaration
| ExposeClause
| UseClause
| IncludeDeclaration
VarDeclarations = [pub | priv] (val | var) VarList ";"
VarList = Var { "," Var }
Var = IDENT | pattern "=" Expr
ExternDeclarations = [pub | priv] extern ExternItems ";"
FuncClassDeclaration = Header FormalParameters Hint Block
Hint = [ "!" IDENT ]
FriendClause = friend IDENT { "," IDENT } ";"
IncludeDeclaration = include ["+"] STRING ";"
ExternItems = ExternItem { "," ExternItem }
ExternItem = IDENT
| IDENT "(" ")"
Header = [Qualifiers] FuncFiberClass IDENT
Qualifiers = pub | priv | final
| pub final | priv final
| final pub | final priv
FuncFiberClass = fun
| fiber
| class
FormalParameters =
| "(" [ ParList ] ")"
| "(" ParList "," "..." ")"
| "(" "..." ")"
ParList = Par { "," Par}
Par = [pub | priv] [val | var] IDENT [ "=" Expr]
ExposeClause = expose ExposeItem { "," ExposeItem }
ExposeItem = QualIdent ["(" IDENT ")"] | QaulIdent ".*"
QualIdent = IDENT {"." IDENT}
UseClause = use IDENT { UseItemClause }
UseItemClause = [former | later] UseItem { "," UseItem }
Item = IDENT [ "(" IDENT ")"]
Block = "{" StmtList "}"
StmtList = { Stmt }
Program = StmtList