From bb0f93953910b759985f616c05b56962b78dd975 Mon Sep 17 00:00:00 2001 From: EDiasAlberto Date: Wed, 5 Jun 2024 21:07:28 +0100 Subject: [PATCH] construct instr IR from label --- src/parser.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/parser.c b/src/parser.c index 538dd9d..be2f874 100644 --- a/src/parser.c +++ b/src/parser.c @@ -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;