construct instr IR from label

This commit is contained in:
EDiasAlberto 2024-06-05 21:07:28 +01:00
parent 8931c151f8
commit bb0f939539

View File

@ -88,10 +88,15 @@ a64inst_instruction *parser(char asmLine[]){
if(strcmp(opcode, ".int") == 0){
//type is directive
instr->type = a64inst_DIRECTIVE;
} else if(strcmp(opcode[strlen(opcode)-1], ":") == 0) {
//type is label
//add to symbol table
instr->type = a64inst_LABEL;
char *opcodeCpy = strdup(opcode);
char *labelData = strtok(opcodeCpy, ":");
instr->data.label = labelData;
} else {
//type is instruction
int operandCount = 0;