Extension of EloquentJS programming language.
WHITES = /\s/y;
COMMENTS = /#.*(\n|\r)?/y;
LEFT_PARENTHESIS = /[(]/y;
RIGHT_PARENTHESIS = /[)]/y;
COMMA = /,/y;
STRING = /"([^"]*)"/y;
NUMBER = /\d+\b/y;
WORD = /[^\s(),#"]+/y;
expression: ( STRING
| NUMBER
| WORD ) apply
apply: /* vacio */
| '(' (expression ',')* expression? ')' apply
First install npm packages:
$ npm install
You can run all tests available with following command:
$ npm test
Then you can use bin/*.js executables to run examples/*.egg files, or any other file you create with EGG syntax.
Also you can use -h for help in any of these executables.
If you run bin/egg.js
without any parameters, a REPL interface will launch up with the same capabilities as egg.js parser and interpreter.
$ node bin/egg.js
> Version 0.5.0
> help()
help() muestra esta ayuda.
exit() sale del bucle REPL.
Ctrl-D sale del bucle REPL.
'-------------------------'
>
$ node bin/egg.js examples/one.egg
50
$ node bin/eggc.js examples/one.egg
Output in file 'examples/one.egg.evm'
examples/one.egg.evm:
{
"type": "apply",
"operator": {
"type": "word",
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
"type": "word",
"name": "define"
},
"args": [
{
"type": "word",
"name": "x"
},
{
"type": "value",
"value": 4
}
]
},
. . .
$ node bin/evm.js examples/one.egg.evm
50