|
|||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||
See:
Description
| Packages | |
|---|---|
| edu.rit.bja8464.cc.bpl | |
| edu.rit.pal6640.cc.bpl | |
| edu.rit.pal6640.cc.bpl.node | |
| edu.rit.pal6640.cc.bpl.value | |
;
statement2;
{
blockStatement1;
.
.
.
blockStatementn;
}
| Expression Type | Expression Description | Precedence | Associativity |
|---|---|---|---|
| Numeric Constant | This evaluates to the given numeric constant | - | - |
| String Constant | This evaluates to the given string constant | - | - |
{ ident: expr, ... } |
This evaluates to the given object contant. This results in a new object containing string keys assciated with their respective values | - | - |
| ident | This evaluates to value of the variable | - | - |
lambda(ident, ...
) {statement1 ;... ; statementn ;}
|
This evaluates to a new function closure with the given formal arguments and body | - | - |
expr1 && expr2
| This evaluates to 1 if expr1 and expr2 both evaluate to non-zero values and to 0 otherwise. | - | - |
expr1 || expr2
| This evaluates to 0 if both expr1 and expr2 evaluate to 0, and 1 otherwise; | 1 | Left |
expr1 > expr2
| This evaluates to 1 if expr1 is numerically greater than expr2 and 0 otherwise; | 2 | Left |
expr1 < expr2
| This evaluates to 1 if expr1 is numerically less than expr2 and 0 otherwise; | 2 | Left |
expr1 >= expr2
| This evaluates to 1 if expr1 is numerically greater than or equal to expr2 and 0 otherwise; | 2 | Left |
expr1 <= expr2
| This evaluates to 1 if expr1 is numerically less than or equal to expr2 and 0 otherwise; | 2 | Left |
expr1 == expr2
| This evaluates to 1 if expr1 is numerically equal to expr2 and 0 otherwise; | 2 | Left |
expr1 != expr2
| This evaluates to 1 if expr1 is numerically NOT equal to expr2 and 0 otherwise; | 2 | Left |
expr1 + expr2
| This evaluates to the sum of expr1 and expr2 | 3 | Left |
expr1 - expr2
| This evaluates to expr2 subtracted from expr1 | 3 | Left |
expr1 * expr2
| This evaluates to the product of expr1 and expr2 | 4 | Left |
expr1 / expr2
| This evaluates to the integer quotient of expr1 divided by expr2 | 4 | Left |
expr1 % expr2
| This evaluates to the remainder of expr1 divided by expr2 | 4 | Left |
| - expr | This evaluates to the negation of expr | 5 | Right |
| + expr | This evaluates to expr | 5 | Right |
| ( expr ) | This evaluates to expr | 6 | None |
expr . ident |
This looks up the key "ident" in expr. It is syntactic sugar for
expr["ident"] (see below). |
6 | None |
expr1[expr2] |
This looks up the value of expr2 in expr1. | 6 | None |
exprf(expr1, ...,
exprn) |
Evaluates exprf (which must be a function value) and invokes it with the arguments expr1 ,,, exprn. | 6 | None |
var.
Variables must be named using a valid identifier. A valid identifier begins with a letter and may contain letters,
nummbers and the underscore '_'. Variable names may not include whitespace. Variables may optionally be declared
with an initial value. Variables may be initialized to an expression, which includes constant values. If a
variable is not declared, it will be assigned the default value of 0.
var ValidIdentifier;
var ValidIdentifier = <expression>;
var keyword is dropped. Variables must be declared before they can be assigned to.
FIXME
Basically, hashtables whose keys are arbitrary objects. var h = {} makes a new one, h[expr] = val; puts val to the key that results from the evaluation of expr.
FIXME
Functions are first class values that close over their lexical scope. They can take any number of arguments. var incBy = lambda(x) { return lambda(y) { return x + y; }; }; var f = incBy(2); var x = f(5); // x is 7
if ( <expression> ) statementOrBlock [ else statementOrBlock ]
if clause is controlled by an expression. If the expression evaluates to to a non-zero value,
the code associated with the if the expression with be evaluated. An else clause may
optionally be appended. If the if evaluates to 0, the code associated with the else
will be executed.
if ( <expression> ) statement;
if ( <expression> )
{
statement1;
.
.
.
statementn;
}
if ( <expression> )
statement;
else
statement;
if ( <expression> )
{
statement1;
.
.
.
statementn;
}
else statement;
if ( <expression> )
statement;
else
{
statement1;
.
.
.
statementn;
}
if ( <expression> )
{
statement1;
.
.
.
statementn;
}
else
{
statement1;
.
.
.
statementn;
}
while ( <expression> ) statementOrBlock
while ( <expression> ) statement;
while ( <expression> )
{
statement1;
.
.
.
statementn;
}
|
|||||||||
| PREV NEXT | FRAMES NO FRAMES | ||||||||