Lunes 26/04/2021
gh workflow
You can now create workflows that are manually triggered with the new workflow_dispatch
event
-
campus-virtual/shared/hello-action/use-hello-world-javascript-action
Review of the Lab “How to Access JS Methods”
expression: (STRING | NUMBER | REGEXP | WORD) apply
apply: /* vacio */
| '(' (expression ',')* expression? ')' apply
| '[' (expression ',')* expression? ']' apply
WHITES = /^(\s|[#;].*|\/\*(.|\n)*?\*\/)*/;
STRING = /^"((?:[^"\\]|\\.)*)"/;
NUMBER = /^([-+]?\d*\.?\d+([eE][-+]?\d+)?)/;
WORD = /^([^\s(),"]+)/;
DOT = /^[.]/;
The curly brackets “{ }” are equivalent to the parenthesis “( )”
The AST now look like:
ast: VALUE{value: String | Number}
| WORD{name: String}
| APPLY{operator: ast, args: [ ast ...]}
| METHODAPPLY{operator: ast, args: [ ast ...]}
We compiled this Egg program:
do(
define(x, array(1,2,3,4)),
define(inc, fun(x,i,_, +(x,1))),
print(x["map"](inc))
)
And followed step by step the file examples/map-js-chain.egg.evm
remote: ULL-ESIT-PL-2021/private-egg path: campus-virtual/shared/egg/eloquentjsegg
➜ eloquentjsegg git:(private2021) ✗ head examples/map-js-chain.egg.evm
{
"type": "apply",
"operator": {
"type": "word",
"name": "do"
},
"args": [
{
"type": "apply",
"operator": {
this allowed us to dig in the following points:
- The uplifting of ASTs from JSON to objects and from objects to Classes
- Review how the evaluation process works
- The evaluation of JS methods
Currying
We followed with the debugger the execution of this program
➜ eloquentjsegg git:(private2021) ✗ cat examples/curry-method.egg
do {
print(4["+", 5](3)) # 4.(+,5)(3) # 12
}
➜ eloquentjsegg git:(private2021) ✗ bin/egg.js examples/curry-method.egg
12
The Lab Extending Egg
Video
Que hemos visto
Extending element (nagative and multiple indices), extending set, Maps/Dictionaries and the ‘:’ lexical operator. Also: Manually triggered workflows