Methods
applyOP(op, a, b) → {any}
Parameters:
Name | Type | Description |
---|---|---|
op |
String | operation string |
a |
any | op1 |
b |
any | op2 |
- Source:
Returns:
operation result
- Type
- any
checkDiv(x) → {any}
Parameters:
Name | Type | Description |
---|---|---|
x |
any | (expected) non-zero number |
- Source:
Returns:
x
- Type
- any
checkNumber(x) → {any}
Parameters:
Name | Type | Description |
---|---|---|
x |
any | (expected) Number type |
- Source:
Returns:
x
- Type
- any
checkType(x, type) → {any}
check x whether is expected type
Parameters:
Name | Type | Description |
---|---|---|
x |
any | primitive value |
type |
String | primitive type |
- Source:
Returns:
x
- Type
- any
Continuation(func, args)
pass func's args
Parameters:
Name | Type | Description |
---|---|---|
func |
function | which will be passed |
args |
Array | func's arguments |
- Source:
evaluate(expr, env, callback) → {any}
Parameters:
Name | Type | Description |
---|---|---|
expr |
Object | expression ast |
env |
Environment | runtime context |
callback |
function | pass to another |
- Source:
Returns:
expression result
- Type
- any
Execute(func, args)
execute function with guarding stack
Parameters:
Name | Type | Description |
---|---|---|
func |
function | which will be called |
args |
Array | func's arguments |
- Source:
GUARD(func, args)
guard the stack
Parameters:
Name | Type | Description |
---|---|---|
func |
function | which need to be guarded |
args |
Array | func's args |
- Source:
InputStream(input) → {Object}
The character input stream, can do something on one char
Parameters:
Name | Type | Description |
---|---|---|
input |
String | code string |
- Source:
Returns:
inputstream used by TokenStream
- Type
- Object
makejs(expr)
Parameters:
Name | Type | Description |
---|---|---|
expr |
any | expression ast |
- Source:
Returns:
string with js code
makeLambda(expr, env) → {function}
As you can see, it returns a plain JavaScript function that
encloses over the environment and the expression to evaluate.
It's important to understand that nothing happens when this closure
is created — but when it's called, it will extend the environment
that it saved at creation time with the new bindings of arguments/values
(if less values are passed than the function's argument list,
the missing ones will get the value false). And then
it just evaluates the body in the new scope.
Parameters:
Name | Type | Description |
---|---|---|
expr |
any | expression ast |
env |
any | runtime context |
- Source:
Returns:
lambda
- Type
- function
parser(input) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
input |
TokenStream | operate tokens |
Returns:
ast
- Type
- Object
TokenStream(input) → {Object}
Parameters:
Name | Type | Description |
---|---|---|
input |
InputStream | which has deal with byte |
- Source:
Returns:
which can parse token to object; used by parser
- Type
- Object