new Egg()
Egg parser and runner that writes program output to an HTML element
Classes
Methods
evaluate(expr, scope) → {any}
Evaluate an expression
Parameters:
| Name | Type | Description |
|---|---|---|
expr |
Object | object with properties type and value |
scope |
Object | the scope of the expression being evaluated |
Returns:
the value an expression evaluates to
- Type
- any
parse(program) → {object}
Convert Egg code into first expression representation
Parameters:
| Name | Type | Description |
|---|---|---|
program |
string | Egg code |
Returns:
Expression representation of Egg code
- Type
- object
parseApply(expr, program) → {Object}
Runs applications in Egg and returns the resulting expression
Parameters:
| Name | Type | Description |
|---|---|---|
expr |
Object | Expression representation of Egg code |
program |
string | Egg code |
Returns:
Expression representation of Egg code
- Type
- Object
parseExpression(program) → {Object}
Convert program string into object representation
Parameters:
| Name | Type | Description |
|---|---|---|
program |
string | Egg code string |
Returns:
expression representation of egg code
- Type
- Object
run(program) → {any}
Parse, evaluate, and excute code in Egg Program.
Parameters:
| Name | Type | Description |
|---|---|---|
program |
string | Egg code |
Returns:
the final value evaluated in a program
- Type
- any
skipSpace(string) → {string}
Trim comments and whitespace before code
Parameters:
| Name | Type | Description |
|---|---|---|
string |
string | Egg code |
Returns:
Egg code with first character of string not whitespace, nor comment.
- Type
- string