Updated the Instruction's structure and updated the Parser accordingly.

This commit is contained in:
2022-10-04 20:37:47 +00:00
parent 1f7989533b
commit 33309a2759
3 changed files with 97 additions and 36 deletions
+16 -2
View File
@@ -37,12 +37,26 @@ Instruction* CreateInstruction(Mnemonic mnemonic) {
}
instruction->Mnemonic = mnemonic;
instruction->ParameterOneType = NoParameter;
instruction->ParameterTwoType = NoParameter;
// instruction->ParameterOne = CreateParameter(NoParameter);
// instruction->ParameterTwo = CreateParameter(NoParameter);
return instruction;
}
Parameter* CreateParameter(OpcodeParameter parameterType) {
Parameter* param = calloc(1, sizeof(Parameter));
if (!param) {
fprintf(stderr, "Failed to calloc room for a Parameter. %s,\n", strerror(errno));
return NULL;
}
param->ParameterType = parameterType;
return param;
}
void FreeInstruction(Instruction* instruction) {
if (!instruction) return;