====== Lexical structure ====== Lexical structure of the language is very close to the JavaScript with some minor additions (e.g. ''const'' and ''type'' constructions). ===== Identifiers ===== Identifiers (nmtokens) start with a alphabetic character, '_' or '$' followed by any number of alphabetic characters, '_', '$' or digits ([0-9]). nmtoken -> [a-zA-Z_$]+[a-zA-Z_$0-9]* ===== Keywords ===== TIScript uses following identifiers as reserved words: type function var if else while return for break continue do switch case default null super new try catch finally throw typeof instanceof in property const get set like ===== Operators ===== The following operators are supported by the language: <= == != >= << >> && || ++ -- += -= *= /= %= &= |= ^= <<= >>= %> <% === !== + - * / ^ | & ===== Special tokens ===== Tokens that have special meaning: .. [] {} # : ? ===== Literals ===== TIScript accepts integer numbers, floating point numbers, stings literals, symbols, regexp literals, stream expressions and binary literals. integer-literal -> [0-9]+ | '0x' [0-9A-Fa-f]+ | ''' [.] ''' float-literal -> [0-9]+ '.' [0-9]+ float-literal -> [0-9]+ '.' 'e'|'E' '+'|'-' [0-9]+ string-literal -> '"' [.]* '"' symbol-literal -> '#' [a-zA-Z_$0-9-]* regexp-literal -> '/' ['/ig'] ';' stream-literal -> '%>' '<%' binary-literal -> '*' [A–Za–z0–9+/=]+ ';' Examples: 34 - Integer 0xAFED1234 - Integer 'f' - Integer, code point value 1.52 - Float 1.e2 - Float 1.e-2 - Float "Hello world!" - String #foo - Symbol ===== Comments ===== Comment is a sequence of characters ignored by compiler. There are two types of comments: * Single line comment: '//' end-of-line * Multi line comment: '/*' '*/'