idk what i did anymore

This commit is contained in:
Annie
2025-05-02 16:12:35 -04:00
parent 18a29d7913
commit e598fad62a
9 changed files with 146 additions and 45 deletions

View File

@ -13,32 +13,33 @@
#include "symbol_table.h"
// these are from page 364
typedef enum {
E_LABEL = 10000, // this is not in the book
E_ADD, // 1 from the list
E_SUB, // 1
E_MUL, // 1
E_DIV, // 1
E_MOD, // 1
E_OR, // 1
E_AND, // 1
E_NEG, // 2
E_NOT, // 2
E_ASSIGN, // 3
E_GOTO, // 4
E_COND_GOTO, // 5 I don't thik I need this because we could just follow the < or the = and just assume that it's a cond got
E_IF_X_TRUE, // 5
E_IF_X_FALSE, // 5
E_LESS_THAN, // 6 rule 1 + 5
E_EQUAL_TO, // 6 rule 1 + 5
E_CALL, // 7
E_PARAM, // 7
E_RETURN, // 7
E_INDEX_COPY_RIGHT, // 8 this is x = y[i]
E_INDEX_COPY_LEFT, // 8 x[i] = y
E_ADDRESS_OF, // 9 x = &y
E_DEREF_RIGHT, // 9 x = *y
E_DEREF_LEFT // 9 x* = y
typedef enum { // these are from page 364
E_LABEL = 10000, // this is not in the book
E_FUNC_START,
E_ADD, // 1 from the list
E_SUB, // 1
E_MUL, // 1
E_DIV, // 1
E_MOD, // 1 TODO: Please change to REM
E_OR, // 1
E_AND, // 1
E_NEG, // 2
E_NOT, // 2
E_ASSIGN, // 3
E_GOTO, // 4
E_COND_GOTO, // 5 I don't thik I need this because we could just follow the < or the = and just assume that it's a cond got
E_IF_X_TRUE, // 5
E_IF_X_FALSE, // 5
E_LESS_THAN, // 6 rule 1 + 5
E_EQUAL_TO, // 6 rule 1 + 5
E_CALL, // 7
E_PARAM, // 7
E_RETURN, // 7
E_INDEX_COPY_RIGHT, // 8 this is x = y[i]
E_INDEX_COPY_LEFT, // 8 x[i] = y
E_ADDRESS_OF, // 9 x = &y
E_DEREF_RIGHT, // 9 x = *y
E_DEREF_LEFT // 9 x* = y
} Op;
typedef enum {
@ -121,4 +122,4 @@ extern Instruction* current;
extern int offset;
extern int currentsp;
extern CGNode* cgList;
extern CGNode* cgList;