jsflat reference


Back


Fundermental

Jsflat is a tiny subset of JavaScript.
The word which reserved as functions and statements are available as a variable.
The valid variable name begins ASCII alphabets and follows ASCII alphabets or numbers.
Types of jsflat are number(IEEE double), string, and function.
Closure is supported.
String literal is represented by "...", the character " is only available as string specifier.
Escape sequence is not suppoted.
Built-in functions are not supported.


Expressions

In jsflat, the expressions shown as follows. Using "()", you can change priority of operator.
Notice: ternary operator(?:) is not supported. - High priority -
operator association description
function not assiciated create anonymous function
++(postfix) --(postfix) (function call) left to right increment, decrement and calling function, respectively
After evaluting value, increment/decrement will execute.
(unary)- (unary)+ ~ ! ++(prefix) --(prefix) left to right negate the sign, preserve the sign, bitwise not, logical not, increment and decrement, respectively
Before evaluting value, increment/decrement will execute.
* / % left to right multipication, division and remainder, respectively
Rule of remainder is the same of C, Java or JavaScript.
+ - left to right addition, subtraction
>> << left to right shift to right or left
< > <= >= left to right comparing the number and returns 1 if true, otherwise 0.
== != left to right comparing the number and returns 1 if true, otherwise 0.
& left to right bitwise and
^ left to right bitwise xor
| left to right bitwise or
&& left to right logical and
|| left to right logical or
= += -= *= /= %= <<= >>= &= ^= |= right to left assignment


Statements

Jsflat supports some statement like C, Java or JavaScript, shown as follows. Jsflat specific statement is shown as follows.
print expr
prints the result of expression to the standard output.