Lexical elements

Comments

A single line comment can be achieved by using ‘//’.

Encoding

Currently, ELI only supports ASCII.

Semicolons

A semicolon may have two meanings

  • Array dimension delimit. It is a separator used in array indexing. For example, arr[x;y];
  • Multiple statement separator. One line code with multiple statements is supported with semicolons. The execution order of statements is from left to right, but within a statement, the execution order remains the same (from right to left). For example, a<-!5;[]<-1+a.

Identifiers

  • An identifier starts with a letter;
  • It can follow with arbitrary numbers and underscores(‘_’);
  • But, the last character cannot be an underscore
identifier ::= letter { letternum | underscore }
underscore ::= {'_'} letternum
letternum  ::= letter | [0-9]
letter     ::= [a-zA-Z]

Keywords

System commands (Details)

)LOAD )SAVE )WSID )FNS
)FLOAD )OUT )OFF )VARS

Operators

Please refer to the primitive function page.

Integer literals

Currently, only decimal integers are supported.

int      ::= ['+' | '_'] decimals
decimals ::= digit { digit }
digit    ::= [0-9]

Floating-point literals

float    ::= decimals '.' decimals [exponent] | decimals exponent
exponent ::= ('e' | 'E') ['+' | '_'] decimals

Examples

0.    //syntax error
0.1
2.3e5
2.e5  //syntax error
.1e3  //syntax error

Complex number literals

complex ::= real 'j' real
real    ::= int | float

Examples

2j3
2.3j4
2j3.4

String literals

A string starts with a single quote('). The content can be any possible ASCII characters. But if you want to include a single quote, you need to type two single quotes consecutively (i.e. '').

string  ::= \' { content } \'
content ::= letters | \'\'
letters ::= all ASCII characters except \'

Examples

'It is a nice string'
'It''s a nice string'