change function depending on the operation

This commit is contained in:
William Bell
2025-08-14 05:42:38 +01:00
parent 340843c99c
commit 4b439fc52a
4 changed files with 25 additions and 15 deletions

View File

@@ -10,7 +10,17 @@
size_t translate_operation(Translated *translated, ParsedOperation *operation,
ArErr *err) {
set_registers(translated, 1);
uint64_t first = push_instruction_byte(translated, OP_LOAD_ADDITION_FUNCTION);
uint64_t first;
switch (operation->operation) {
case TOKEN_PLUS:;
first = push_instruction_byte(translated, OP_LOAD_ADDITION_FUNCTION);
break;
default:
*err = create_err(operation->line, operation->column,
operation->length, translated->path, "Syntax Error",
"unknown operation");
return 0;
}
push_instruction_byte(translated, OP_INIT_CALL);
push_instruction_code(translated, operation->to_operate_on.size);