[NAME]
ALL.dao.grammar.statement

[TITLE]
Statements

[DESCRIPTION]

Drafting in progress.

 0.1   Declaration Statements  

     
   1  ConstSpecifier ::= 'const' | 'global' 'const' | 'const' 'global'
   2  VarSpecifier   ::= 'var' | 'global' | 'static'
   3  
   4  ConstDeclItem ::= Identifier [ ( '=' | ':' Type '=' ) ConstExpression ]
   5  VarDeclItem   ::= Identifier [ ( '=' | ':' Type '=' ) Expression ]
   6  
   7  ConstDeclaration    ::= ConstSpecifier ConstDeclItem { ',' ConstDeclItem }
   8  VarDeclaration      ::= VarSpecifier   VarDeclItem   { ',' VarDeclItem }
   9  
  10  LocalVarDeclaration ::= [ 'var' ] VarDeclItem { ',' VarDeclItem }
  11  
  12  DeclarationStmt ::= ConstDeclaration | VarDeclaration
     


 0.2   Basic Statement  

     
   1  BasicStatement ::= DeclarationStmt | Expression | 'break' | 'skip'
     


 0.3   If-else Statement  

     
   1  ControlBlock ::= Statement | '{' [ StatementBlock ] '}'
   2  
   3  IfElseStmt ::= 'if' '(' [ LocalVarDeclaration ';' ] Expression ')' ControlBlock
   4                 { 'else' 'if' '(' [ LocalVarDeclaration ';' ] Expression  ')' ControlBlock }
   5                 [ 'else' ControlBlock ]
     


 0.4   For Loop Statement  

     
   1  CFor  ::= 'for' '(' [ LocalVarDeclaration ] ';' [ Expression ] ';' [ ExpressionList ] ')'
   2                ControlBlock
   3  
   4  APFor ::= 'for' '(' [ 'var' ] Identifier '=' Expression ':' [ Expression ':' ] Expression ')'
   5                ControlBlock
   6  
   7  ForIn ::= 'for' '(' [ 'var' ] Identifier 'in' Expression {';' Identifier 'in' Expression} ')'
   8                ControlBlock
   9  
  10  ForStmt ::= APFor | CFor | ForIn
     


 0.5   While Loop Statement  

     
   1  WhileStmt ::= 'while' '(' [ LocalVarDeclaration ';' ] Expression ')' ControlBlock
     


 0.6   Do-while Looping Statement  

     
   1  DoWhileStmt ::= 'do' ControlBlock 'while' '(' Expression ')'
     


 0.7   Switch-case Statement  

     
   1  SwitchCaseStmt ::= 'switch' '(' Expression ')' '{'
   2                     { 'case' Expression [ ( ',' | '...' ) Expression ] ':' ControlBlock }
   3                     [ 'default' ':' ControlBlock ]
   4                     '}'
     


 0.8   Defer Statement  

     
   1  DeferStmt ::= 'defer' '{' StatementBlock '}'
     


 0.9   Framed Block Statement  

     
   1  FramedBlock ::= 'frame' [ '(' Expression ')' ] '{' StatementBlock '}'
     


 0.10   Type Aliasing Statement  

     
   1  TypeAlias ::= 'type' Identifier '=' Type
     


 0.11   Use Enum Statement  

     
   1  UseEnum ::= 'use' 'enum' Identifier
     
Expose the symbols of the enum symbol type to the current namespace.

 0.12   Use Syntax Statement  

     
   1  UseSyntax ::= 'use' 'syntax' Identifier
     
Use the syntax in the current file.

 0.13   Use Namespace Statement  

     
   1  UseNamespace ::= 'use' Identifier
     
Import the constants and globals from another namespace to the current.

 0.14   Load Statement  

     
   1  LoadStmt ::= 'load' ( String | { Identifier ('.' | '::') } Identifier ) [ 'as' Identifier ]
     


 0.15   Load Statement  

     
   1  Statement ::= DeclarationStmt
   2              | BasicStatement
   3              | IfElseStmt
   4              | ForStmt
   5              | WhileStmt
   6              | DoWhileStmt
   7              | SwitchCaseStmt
   8              | DeferStmt
   9              | FramedBlock
  10              | TypeAlias
  11              | UseEnum 
  12              | UseSyntax
  13              | UseNamespace
  14              | LoadStmt