[NAME]
ALL.dao.grammar.expression

[TITLE]
Expressions

[DESCRIPTION]

Drafting in progress.

 0.1   Atomic Expression  

     
   1  AtomicExpression ::= Identifier | Integer | Float
   2                     | ComplexImaginary | String | Symbol
     


 0.2   Primary Expression  

     
   1  SectionParamValist ::= '...'
   2  SectionParamNames ::= Identifier { ',' Identifier }
   3  SectionParamItems ::= SectionParamValist | SectionParamNames [ ',' SectionParamValist ]
   4  SectionParamList ::= '[' [ SectionParamItems ] [ 'as' Identifier ] ']'
   5  
   6  PrimaryExpression ::= AtomicExpression 
   7                      | EnumerativeExpression
   8                      | '(' Expression ')'
   9                      | PrimaryExpression '::' Identifier
  10                      | PrimaryExpression '.'  Identifier
  11                      | PrimaryExpression '(' [ ArgumentList ] ')'
  12                      | PrimaryExpression '[' [ ExpressionList [ ',' ] ] ']'
  13                      | PrimaryExpression '{' [ SectionParamList ] [StatementBlock] '}'
  14                      | PrimaryExpression '.{' [ ArgumentList ] '}'
     


 0.3   Expression List  

     
   1  ExpressionList ::= Expression { ',' Expression }
     


 0.4   Argument List  

     
   1  ArgumentItem ::= [ Identifier '=' ] Expression
   2  
   3  ArgumentList = ArgumentItem { ',' ArgumentItem }
     


 0.5   Enumerative Expression  

     
   1  EnumerativeExpression ::= Array | List | Map | Tuple
     


 0.6   Array  

     
   1  Vector  ::= '[' [ ExpressionList [ ',' ] ] ']'
   2  Matrix  ::= '[' ExpressionList { ';' ExpressionList } ']'
   3  Vector2 ::= 'array' '{' [ ExpressionList [ ',' ] ] '}'
   4  Matrix2 ::= 'array' '{' ExpressionList { ';' ExpressionList } '}'
   5  
   6  ArithProgArray  ::=         '[' Expression ':' [ Expression ':' ] Expression ']'
   7  ArithProgArray2 ::= 'array' '{' Expression ':' [ Expression ':' ] Expression '}'
   8  
   9  Array ::= Vector | Matrix | ArithProgArray | Vector2 | Matrix2 | ArithProgArray2
     


 0.7   List  

     
   1  ListEnum      ::= [ 'list' ] '{' [ ExpressionList [ ',' ] ] '}'
   2  ArithProgList ::= [ 'list' ] '{' Expression ':' [ Expression ':' ] Expression '}'
   3  
   4  List ::= ListEnum | ArithProgList
     
Note: a list enumeration started with { has to appear inside an expression.

 0.8   Map  

     
   1  MapKeyValue  ::= Expression => Expression
   2  HashKeyValue ::= Expression -> Expression
   3  
   4  MapEnum  ::= [ 'map' ] '{' MapKeyValue  { ',' MapKeyValue  } [ ',' ] '}'
   5  HashEnum ::= [ 'map' ] '{' HashKeyValue { ',' HashKeyValue } [ ',' ] '}'
   6  
   7  Map ::= ConstEmptyMap | ConstEmptyHash | MapEnum | HashEnum
     


 0.9   Tuple  

     
   1  TupleEnum1 ::=         '('   ArgumentItem ',' ')'
   2  TupleEnum2 ::=         '('   ArgumentItem { ',' ArgumentItem } [ ',' ]   ')'
   3  TupleEnum3 ::= 'tuple' '{' [ ArgumentItem { ',' ArgumentItem } [ ',' ] ] '}'
   4  
   5  Tuple ::= TupleEnum1 | TupleEnum2 | TupleEnum3
     


 0.10   Anonymous Routine  

     
   1  AnParamItem1 ::= [ 'invar' ] Identifier [ ':' Type ]
   2  AnParamItem2 ::= [ 'invar' ] Identifier [ ':' Type ] '=' Expression
   3  ValistParam  ::= [ 'invar' ] '...' [ ':' Type ]
   4  
   5  AnParamList1 ::= AnParamItem1 { ',' AnParamItem1 }
   6  AnParamList2 ::= AnParamList1 { ',' AnParamItem2 } [ ',' ValistParam ]
   7  AnParamList3 ::= AnParamItem2 { ',' AnParamItem2 } [ ',' ValistParam ]
   8  AnParamList  ::= ( AnParamList2 | AnParamList3 | ValistParam ) [ 'as' Identifier ]
   9  
  10  AnonymousRoutine ::= 'routine' [ '(' [ AnParamList ] ')' ] '{' StatementBlock '}'
     


 0.11   Expression  

     
   1  Expression ::= PrimaryExpression
   2               | LeftUnaryOperator PrimaryExpression
   3               | PrimaryExpression BinaryOperator PrimaryExpression
   4               | '(' Type ')' PrimaryExpression
   5               | AnonymousRoutine