Differences

This shows you the differences between two versions of the page.

Link to this comparison view

alf:teme:tema_en_5 [2020/05/06 15:01]
alexandru.radovici
alf:teme:tema_en_5 [2020/05/12 21:01] (current)
alexandru.radovici
Line 4: Line 4:
  
 <note important>​ <note important>​
-Deadline: **22nd of May, 23:55**\\+Deadline: **26nd of May, 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 11: Line 11:
 ===== What do you have to do ===== ===== What do you have to do =====
  
-The purpose of the homework is to translate an Alf Langauge provided as an AST file with semantic data into Web Assembly. Your program will receive two parameters: source file (the file from the previous homework, with the symbol table, the AST and the error list) and the output file. **You don't need a working version of homework 4!** The test files have already been generated and you can find them on [[https://​github.com/​alexandruradovici/​alf/​tree/​master/​Devoirs/​assembly/​verify/​assembly|github]].+The purpose of the homework is to translate an Alf Langauge provided as an AST file with semantic data into Web Assembly. Your program will receive two parameters: source file (the file from the previous homework, with the symbol table, the AST and the error list) and the output file. **You don't need a working version of homework 4!** The test files have already been generated and you can find them on [[https://​github.com/​upb-fils/​alf/​tree/​master/​Devoirs/​assembly/​verify/​assembly|github]].
 The programs will have any variable type. String concatenation is not provided (except for a few tests test). The programs will have any variable type. String concatenation is not provided (except for a few tests test).
  
 <code bash> <code bash>
-node main.js ​file.alf.json ​file.wat+node main.js ​fisier.alf.json ​fisier.alf.opt.json fisier.wat [optimisations,​]
 </​code>​ </​code>​
  
Line 68: Line 68:
  
 === String === === String ===
-The representation used for strings is Pascal and has a 256 bytes length:+The representation used for strings is Pascal ​type and has a 256 bytes length:
   * 1 byte for length   * 1 byte for length
   * 255 bytes for symbols   * 255 bytes for symbols
 +
 +{{ :​alf:​teme:​strings.png?​nolink&​300 |}}
  
  
Line 149: Line 151:
  
 ==== Strings ==== ==== Strings ====
-All the string constants (values) are stored in the main memory right after the global variables. You can use ''​(*data+All the string constants (values) are stored in the main memory right after the global variables. You can use ''​(data ​(i32.const address) "​\SSvalue"​)''​ where SS is the base16 value of the length. The first byte in the string represents the string'​s length.
  
-Example [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf|string]] [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf.opt.json|string.alf.opt.json]] [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf.wat|string.alf.wat]]+Example [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf|string.alf]] [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf.opt.json|string.alf.opt.json]] [[https://​github.com/​UPB-FILS/​alf/​blob/​master/​Devoir/​assembly/​verify/​assembly/​1_variable_definition/​string.alf.wat|string.alf.wat]]
  
 ===== Steps for writing the homework ===== ===== Steps for writing the homework =====
Line 162: Line 164:
   * constant folding   * constant folding
   * delete unused variables and functions   * delete unused variables and functions
 +
 +For the bonus, there are two extra parameters in the command line
 +
 +<code bash>
 +node main.js fisier.alf.json fisier.alf.opt.json fisier.wat [fold_constants] [unused]
 +</​code>​
 +
 +<​note>​[] means that it is optional</​note>​
  
 ===== Testing ===== ===== Testing =====
alf/teme/tema_en_5.1588766498.txt.gz · Last modified: 2020/05/06 15:01 by alexandru.radovici
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0