This shows you the differences between two versions of the page.
alf:teme:tema3_en [2020/03/22 17:01] alexandru.radovici |
alf:teme:tema3_en [2020/04/07 20:06] (current) alexandru.radovici |
||
---|---|---|---|
Line 4: | Line 4: | ||
<note important> | <note important> | ||
- | Deadline: **7th of April, 23:55**\\ | + | Deadline: **12th of April, 23:55**\\ |
Points: **2 points** out of the final grade\\ | Points: **2 points** out of the final grade\\ | ||
Upload the homework: [[https://vmchecker.cs.pub.ro|vmchecker.cs.pub.ro]]\\ | Upload the homework: [[https://vmchecker.cs.pub.ro|vmchecker.cs.pub.ro]]\\ | ||
Line 31: | Line 31: | ||
Try running small scripts to test every feature. | Try running small scripts to test every feature. | ||
+ | |||
+ | A useful debugging too is [[https://nolanlawson.github.io/jison-debugger|jison-debugger]] | ||
===== AST Format ===== | ===== AST Format ===== | ||
Line 48: | Line 50: | ||
The list of the node ids is: | The list of the node ids is: | ||
- | * program - the actual program | + | * script - the actual program |
* var - variable definition | * var - variable definition | ||
* expr - any expression | * expr - any expression | ||
Line 56: | Line 58: | ||
* prop - a property of a class | * prop - a property of a class | ||
* vector - array definition | * vector - array definition | ||
- | * element - an element of an array | + | * element_of_vector - an element of an array |
* if_then - if statement | * if_then - if statement | ||
- | * loop_while - while statement | + | * loop_when - while statement |
* loop_go - for statement | * loop_go - for statement | ||
* function_call - call (run) a function | * function_call - call (run) a function | ||
* return - value of a function | * return - value of a function | ||
- | * value - a value (integer, logic, float, string, user_defined) | + | * value - a value (int, bool, float, string, character, user_defined) |
===== Questions ===== | ===== Questions ===== | ||
Line 243: | Line 245: | ||
</code> | </code> | ||
- | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_class|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_struct|Example]] |
=== Property access === | === Property access === | ||
Line 266: | Line 268: | ||
</code> | </code> | ||
- | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_class|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_struct|Example]] |
Line 302: | Line 304: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | id:"vector_element", | + | id:"element_of_vector", |
vector:{ | vector:{ | ||
expression for array | expression for array | ||
Line 456: | Line 458: | ||
</code> | </code> | ||
- | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/4_messages|Example]] | + | [[https://github.com/UPB-FILS/alf/tree/master/Devoir/alf/verify/alf/4_function|Example]] |
=== Return === | === Return === | ||
Line 623: | Line 625: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | id:"loop_for", | + | id:"for", |
variable:variable_name, | variable:variable_name, | ||
exp:{ | exp:{ | ||
Line 639: | Line 641: | ||
<code javascript> | <code javascript> | ||
{ | { | ||
- | id:"loop_for", | + | id:"for", |
variable:variable_name, | variable:variable_name, | ||
from: { expression }, | from: { expression }, |