    [NAME]
    ALL.dao.grammar.expression

    [TITLE]
    Expressions

    [DESCRIPTION]

    Drafting in progress.

     0.1   Atomic Expression

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

     0.2   Primary Expression

       1  PrimaryExpression ::= AtomicExpression
       2                      | EnumerativeExpression
       3                      | '(' Expression ')'
       4                      | PrimaryExpression '::' Identifier
       5                      | PrimaryExpression '.'  Identifier
       6                      | PrimaryExpression '(' [ ArgumentList ] ')'
       7                      | PrimaryExpression '[' [ ExpressionList [ ',' ] ] ']'
       8                      | PrimaryExpression '{' [ ArgumentList [ ',' ] ] '}'
       9                      | 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 ::= Identifier [ ':' Type ]
       2  AnParamItem2 ::= Identifier [ ':' Type ] '=' Expression
       3
       4  AnParamList1 ::= AnParamItem1 { ',' AnParamItem1 }
       5  AnParamList2 ::= AnParamList1 { ',' AnParamItem2 } [ ',' '...' ]
       6  AnParamList3 ::= AnParamItem2 { ',' AnParamItem2 } [ ',' '...' ]
       7  AnParamList  ::= ( AnParamList2 | AnParamList3 | '...' ) [ 'as' Identifier ]
       8
       9  AnonymousRoutine ::= 'routine' [ '(' [ AnParamList ] ')' ] '{' StatementBlock '}'

     0.11   Expression

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