User Tools

Site Tools


compilers:codgen_tutorial

Differences

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

Link to this comparison view

Next revision
Previous revision
compilers:codgen_tutorial [2015/12/02 13:59]
deva created
compilers:codgen_tutorial [2016/12/15 11:06] (current)
deva
Line 3: Line 3:
 == Step 1: Preparation == == Step 1: Preparation ==
  
-  * If you have not completed the semantic analyser, [[http://​deva.web.elte.hu/​compilers/lab/​semantic-analyser.zip|download this version]] and test it on all [[http://​deva.web.elte.hu/​compilers/lab/​while-tests.zip|test files]].+  * If you have not completed the semantic analyser, [[http://​deva.web.elte.hu/​compilers/​semantic-analyser.zip|download this version]] and test it on all [[http://​deva.web.elte.hu/​compilers/​while-tests.zip|test files]].
   * Review the lecture notes on the [[compilers:​assembly|assembly]] and [[compilers:​codegen|code generation]] topics and make sure you understand the concepts.   * Review the lecture notes on the [[compilers:​assembly|assembly]] and [[compilers:​codegen|code generation]] topics and make sure you understand the concepts.
  
 == Step 2: Extend the symbol table == == Step 2: Extend the symbol table ==
  
-  * Create a function in the Parser class that is able to return a fresh label (for example ''​label0'',​ ''​label1'',​ ''​label2''​ ...) each time it is called. (Use a static ​int attribute to store the label index and use the ''​stringstream''​ type build the label.)+  * Create a function in the Parser class that is able to return a fresh label (for example ''​label0'',​ ''​label1'',​ ''​label2''​ ...) each time it is called. (Use an int attribute to store the label index and use the ''​stringstream''​ type build the label.)
   * Add a ''​string label;''​ field to the data type stored in the symbol table.   * Add a ''​string label;''​ field to the data type stored in the symbol table.
   * Change the constructor of that data type to get the label as parameter.   * Change the constructor of that data type to get the label as parameter.
compilers/codgen_tutorial.1449061149.txt.gz · Last modified: 2015/12/02 13:59 by deva