This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | |||
compilers:codgen_tutorial [2016/12/15 11:04] deva |
compilers:codgen_tutorial [2016/12/15 11:06] (current) deva |
||
---|---|---|---|
Line 8: | Line 8: | ||
== 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. |