[NAME]
ALL.dao.grammar.constexpr

[TITLE]
Constant Expressions

[DESCRIPTION]

Drafting in progress.

 0.1   Constant Atomic Expression  

     
   1  ConstAtomicExpression ::= ConstIdentifier | Integer | Float
   2                          | ComplexImaginary | String | Symbol
   3                          | none | false | true
     
Where ConstIdentifier represents identifiers for constants such as routines, classes, nam
espaces, type names and user defined constants.

 0.2   Constant Primary Expression  

     
   1  BuiltinMathFuncsMinusRand ::= 'abs' | 'ceil' | 'floor'
   2                          | 'real' | 'imag' | 'arg' | 'norm'
   3                          | 'acos' | 'cos' | 'cosh'
   4                          | 'asin' | 'sin' | 'sinh'
   5                          | 'atan' | 'tan' | 'tanh'
   6                          | 'exp'  | 'log' | 'sqrt'
   7  
   8  ConstPrimaryExpression ::= ConstAtomicExpression 
   9                           | ConstEnumerativeExpression
  10                           | '(' ConstExpression ')'
  11                           | ConstPrimaryExpression '::' Identifier
  12                           | ConstPrimaryExpression '[' [ ConstExpression ] ']'
  13                           | BuiltinMathFuncsMinusRand '(' ConstExpression ')'
  14                           | ConstExpression '(' [ ConstExpressionList ] ')'
     


 0.3   Constant Expression List  

     
   1  ConstExpressionList ::= ConstExpression { ',' ConstExpression }
     


 0.4   Constant Enumerative Expression  

     
   1  ConstEnumerativeExpression ::= ConstArray | ConstList | ConstMap | ConstTuple
     


 0.5   Constant Array  

     
   1  ConstVector  ::= '[' [ ConstExpressionList [ ',' ] ] ']'
   2  ConstMatrix  ::= '[' ConstExpressionList { ';' ConstExpressionList } ']'
   3  ConstVector2 ::= 'array' '{' [ ConstExpressionList [ ',' ] ] '}'
   4  ConstMatrix2 ::= 'array' '{' ConstExpressionList { ';' ConstExpressionList } '}'
   5  
   6  ConstArray   ::= ConstVector | ConstMatrix | ConstVector2 | ConstMatrix2
     


 0.6   Constant List  

     
   1  ConstList ::= [ 'list' ] '{' [ ConstExpressionList [ ',' ] ] '}'
     
Note: a list enumeration started with { has to appear inside an expression.

 0.7   Constant Map  

     
   1  ConstMapKeyValue  ::= ConstExpression => ConstExpression
   2  ConstHashKeyValue ::= ConstExpression -> ConstExpression
   3  
   4  ConstEmptyMap  ::= '{' '=>' '}' | 'map' '{' [ '=>' ] '}'
   5  ConstEmptyHash ::= '{' '->' '}' | 'map' '{'   '->'   '}'
   6  
   7  ConstMapEnum  ::= [ 'map' ] '{' ConstMapKeyValue  { ',' ConstMapKeyValue  } [ ',' ] '}'
   8  ConstHashEnum ::= [ 'map' ] '{' ConstHashKeyValue { ',' ConstHashKeyValue } [ ',' ] '}'
   9  
  10  ConstMap ::= ConstEmptyMap | ConstEmptyHash | ConstMapEnum | ConstHashEnum
     


 0.8   Constant Tuple  

     
   1  ConstArgumentItem ::= [ Identifier '=' ] ConstExpression
   2  
   3  ConstTupleEnum1 ::=         '('   ConstArgumentItem ',' ')'
   4  ConstTupleEnum2 ::=         '('   ConstArgumentItem ( ',' ConstArgumentItem ) + [ ',' ] ')'
   5  ConstTupleEnum3 ::= 'tuple' '{' [ ConstArgumentItem { ',' ConstArgumentItem } [ ',' ] ] '}'
   6  
   7  ConstTuple ::= ConstTupleEnum1 | ConstTupleEnum2 | ConstTupleEnum3
     


 0.9   Constant Expression  

     
   1  ConstExpression ::= ConstPrimaryExpression
   2                    | LeftUnaryOperator ConstPrimaryExpression
   3                    | ConstPrimaryExpression BinaryOperator ConstPrimaryExpression