Added stubs for all emit funcs and added the 3 fields discussed in the library t#51

This commit is contained in:
Meyer Simon
2025-04-01 12:53:31 -04:00
parent 24caa0e9a7
commit 05b641a32e
2 changed files with 73 additions and 0 deletions

View File

@ -19,8 +19,14 @@ typedef struct {
TableNode * operand1;
TableNode * operand2;
int label;
int instruction;
Instruction * prev;
Instruction * next;
} Instruction;
Instruction * start = NULL;
Instruction * current = NULL;
void emit_binary_op(char* result, char* op, char* arg1, char* arg2);
void emit_unary_op(char* result, char* op, char* arg);
void emit_assignment(char* target, char* source);
@ -35,3 +41,19 @@ void emit_assignment(char* target, char* source);
void emit_as_file(FILE * out_file, Instruction * instr_arr);
// * Implement instruction array storage for backpatching
void emit_label(char* label);
void emit_jump(char* label);
void emit_conditional_jump(char* condition, char* label);
void emit_function_start(char* name);
void emit_parameter(char* param);
void emit_function_call(char* result, char* name);
void emit_return(char* value);
void emit_reserve(char* result, char* type_name, int size);
void emit_release(char* pointer);
void emit_field_access(char* result, char* record, char* field);
void emit_array_access(char* result, char* array, char* index, char* dimension);
void emit_bounds_check(char* index, char* size, char* error_label);