diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-10 12:48:53 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-10 12:48:53 +0000 |
commit | 28251a0c6f4e31c63c12746ffa77e05c669ef80d (patch) | |
tree | e1a9dfad8db410a0ae0db0e56f1bfc9accac6262 /Notes.org | |
parent | 3e145bf08b1ffcccb4df8f2fc34f5bb95b5b250c (diff) | |
download | Compiler-28251a0c6f4e31c63c12746ffa77e05c669ef80d.tar.gz Compiler-28251a0c6f4e31c63c12746ffa77e05c669ef80d.zip |
Changing printasm
Diffstat (limited to 'Notes.org')
-rw-r--r-- | Notes.org | 43 |
1 files changed, 38 insertions, 5 deletions
@@ -3,6 +3,7 @@ #+AUTHOR: Yann Herklotz #+EMAIL: ymherklotz@gmail.com #+DESCRIPTION: These are notes about the Compiler project. +#+DATE: <2017-03-09 Thu> * Lexer @@ -89,11 +90,43 @@ - move :: Pseudo instruction interpreted as (add $rt, $rs, $zero) - nop :: No Operation - sw :: Store Word +*** TODOs +**** Expression -*** TODOs +***** void evaluate(VariableStackBindings binding) + + Statements evaluate the expression by writing it out and printing the resulting asm + onto the command line. I will also have to pass the bindings to the evaluate function + + examples: + + z = a + b + c, will be calculated as $2 = b + c, and then $2 = a + $2 + + This should happen automatically because of recursion. + Have to be careful because of the way the expressions are parsed. + Constant expressions will just output li $2, 6 for example + +**** Function class + +**** Statement class + + - Need function that prints declaration bits and expression bits, as well as connected + statements + +**** Definition class + + - need function that will print the code for declaration. Basic code should be: + + li $2, 6 + sw $2, 4($fp) + + - Before that is executed it should evaluate the expression. + + - The expression should be the thing doing: li $2, 6 + That is if we want a 6 stored in the variable. - - Analyse tree with map including "name", and struct with "type" and "stack - position", and a counter passed by reference. - - This function will be called by printasm() in the base class and will only be - implemented by function. + - The declaration class should only be in charge of storing it in the right location in + the stack. + + |