This shows you the differences between two versions of the page.
|
alf:teme:tema3_en_draft [2019/03/16 19:11] teodor.deaconu [Comments] |
alf:teme:tema3_en_draft [2019/04/03 10:25] (current) alexandru.radovici |
||
|---|---|---|---|
| Line 4: | Line 4: | ||
| <note important> | <note important> | ||
| - | Deadline: **15th of April, 23:55**\\ | + | Deadline: **7th 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. | ||
| - | |||
| - | ===== Syntax highlighting ===== | ||
| - | If you use sublime text, you may use this [[https://github.com/alexandruradovici/alf2018/blob/master/Devoirs/alf/verify/alf.tmLanguage|syntax highlighting file]] to write Alf language. | ||
| - | |||
| - | You may [[http://stackoverflow.com/questions/12785583/add-ts-language-files-to-sublime-text-to-support-additional-syntax-coloring|read]] here how to add the file. | ||
| ===== AST Format ===== | ===== AST Format ===== | ||
| Line 72: | Line 67: | ||
| ===== Questions ===== | ===== Questions ===== | ||
| - | If you have any questions related to the homework, please ask them by posting an issue on the github [[https://github.com/alexandruradovici/alf2018.git|repository]] with the title format //[calculator] <your question title>//. You will need a github account for that. | + | If you have any questions related to the homework, please ask them by posting an issue on the github [[https://github.com/upb-fils/alf|repository]] with the title format //[alf] <your question title>//. You will need a github account for that. |
| <note warning> | <note warning> | ||
| Line 78: | Line 73: | ||
| </note> | </note> | ||
| - | If you want to receive an email when issues are posted or when there are new messages, got to the github [[https://github.com/alexandruradovici/alf2018|repository]] and click //Watch//. | + | If you want to receive an email when issues are posted or when there are new messages, got to the github [[https://github.com/upb-fils/alf|repository]] and click //Watch//. |
| | | ||
| Line 100: | Line 95: | ||
| <code> | <code> | ||
| a=10; | a=10; | ||
| - | b=20l; | + | b=20; |
| s=55; | s=55; | ||
| </code> | </code> | ||
| Line 178: | Line 173: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/1_value|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/1_value|Example]] |
| ==== Variable definition ==== | ==== Variable definition ==== | ||
| Line 214: | Line 209: | ||
| { | { | ||
| type:"data type", | type:"data type", | ||
| - | title: "varable name", | + | title: "variable name", |
| - | value: "varable value" | + | value: "variable value" |
| }, | }, | ||
| ] | ] | ||
| Line 221: | Line 216: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/2_variable_definition|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/2_variable_definition|Example]] |
| ==== Sruct ==== | ==== Sruct ==== | ||
| Line 249: | Line 244: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/6_class|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_class|Example]] |
| === Property access === | === Property access === | ||
| Line 272: | Line 267: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/6_class|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/6_class|Example]] |
| Line 318: | Line 313: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/7_array|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/7_array|Example]] |
| ==== Expressions ==== | ==== Expressions ==== | ||
| Line 398: | Line 393: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/2_variable_definition|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/2_variable_definition|Example]] |
| Line 426: | Line 421: | ||
| <code> | <code> | ||
| - | fn sum:int (a:int, b:int) => a+b; | + | fn sum:integer (a:integer, b:integer) => a+b; |
| </code> | </code> | ||
| <code> | <code> | ||
| - | fn power:int (a:int, n:int) | + | fn power:integer (a:integer, n:integer) |
| begin | begin | ||
| - | def p:int; | + | def p:integer; |
| - | def i:int; | + | def i:integer; |
| if n == 0 then | if n == 0 then | ||
| begin | begin | ||
| Line 462: | Line 457: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/4_messages|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/4_messages|Example]] |
| === Return === | === Return === | ||
| Line 509: | Line 504: | ||
| { | { | ||
| id:"function_call", | id:"function_call", | ||
| - | message:"function_name", | + | function:"function_name", |
| parameters:{ // dictionary of parameter name or index and value | parameters:{ // dictionary of parameter name or index and value | ||
| "parameter1": parameter_value, | "parameter1": parameter_value, | ||
| Line 518: | Line 513: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/4_messages|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/4_messages|Example]] |
| ==== Branch ==== | ==== Branch ==== | ||
| Line 559: | Line 554: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/5_branch|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/5_branch|Example]] |
| ==== Loops ==== | ==== Loops ==== | ||
| Line 655: | Line 650: | ||
| </code> | </code> | ||
| - | [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf/verify/alf/3_loop|Example]] | + | [[https://github.com/upb-fils/alf/tree/master/Devoir/alf/verify/alf/3_loop|Example]] |
| ===== Errors ===== | ===== Errors ===== | ||
| Line 726: | Line 721: | ||
| #else | #else | ||
| p := "Linux" {this source code is ignored if platform is not linux} | p := "Linux" {this source code is ignored if platform is not linux} | ||
| - | end | + | #endif |
| </code> | </code> | ||
| Line 757: | Line 752: | ||
| ==== Public Tests ==== | ==== Public Tests ==== | ||
| - | You can download the public tests from the GitHub [[https://github.com/alexandruradovici/alf2018/tree/master/Devoirs/alf|repository]]. | + | You can download the public tests from the GitHub [[https://github.com/upb-fils/alf/tree/master/Devoir/alf|repository]]. |
| To run the tests, download the contents of the repository in the folder with the homework. Enter the //verify// folder and run ./run_all.sh. | To run the tests, download the contents of the repository in the folder with the homework. Enter the //verify// folder and run ./run_all.sh. | ||
| Line 807: | Line 802: | ||
| * your main file (set in package.json) | * your main file (set in package.json) | ||
| * your javascript files (*.js) | * your javascript files (*.js) | ||
| - | * your jison file (grammar.jison) | + | * your l and y file (grammar.l and grammar.y) |
| * the package.json file | * the package.json file | ||
| * the Readme file | * the Readme file | ||
| Line 830: | Line 825: | ||
| echo '{ "node":true, "loopfunc": true, "esnext":true }' > .jshintrc | echo '{ "node":true, "loopfunc": true, "esnext":true }' > .jshintrc | ||
| jshint *.js | jshint *.js | ||
| - | jison grammar.jison -o grammar.js | + | jison grammar.y grammar.l -o grammar.js |
| </code> | </code> | ||