Updated the way Instructions keep track of symbols. Only their name is important but we need the Symbols to be able to track which Instruction they point to (if they do that is, i.e. a label symbol).
This commit is contained in:
+4
-2
@@ -2,7 +2,9 @@
|
||||
#define OPCODES_H
|
||||
|
||||
#include <string.h>
|
||||
#include "symbols_table.h"
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
//#include "symbols_table.h"
|
||||
|
||||
typedef enum {
|
||||
R1, R2, R3, R4, R5, R6, R7, R8
|
||||
@@ -27,7 +29,7 @@ typedef struct {
|
||||
union {
|
||||
int Number; //ConstanrParam
|
||||
Registers Register; //Register param
|
||||
Symbol* Symbol; //Address param
|
||||
char* Symbol; //Symbol* Symbol; //Address param
|
||||
} Value;
|
||||
} Parameter;
|
||||
|
||||
|
||||
@@ -5,23 +5,20 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "opcodes.h"
|
||||
|
||||
#define SYMBOLSTABLE_DEFAULT_CAPACITY 128
|
||||
|
||||
typedef enum {
|
||||
ValueAt,
|
||||
Address
|
||||
} SymbolType;
|
||||
|
||||
typedef struct {
|
||||
char* Name;
|
||||
int Length;
|
||||
int Resolved;
|
||||
int InstructionPointer;
|
||||
|
||||
union {
|
||||
char* Text;
|
||||
int Number;
|
||||
//Instruction Instruction;
|
||||
Instruction* Instruction;
|
||||
} Value;
|
||||
} Symbol;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user