compilator-2000/yacc_util.h
Arnaud Vergnet a1c0f7a19f add if
2021-04-06 18:17:10 +02:00

30 lines
1.2 KiB
C

#include "symbol_table.h"
#include "asm_instructions.h"
#ifndef COMPILATOR_2000_YACC_UTIL_H
#define COMPILATOR_2000_YACC_UTIL_H
typedef struct Condition {
Instruction instruction;
int not;
} Condition;
void write_affectation(SymbolTable* symbolTable, InstructionTable *instructionTable, char* symbol_dest, SymbolItem* src);
const SymbolItem* write_op(SymbolTable* symbol_table, InstructionTable *instruction_table, Instruction instruction, SymbolItem *op1, SymbolItem *op2);
const SymbolItem* write_negation(SymbolTable* symbol_table, InstructionTable *instruction_table, SymbolItem *op2);
const SymbolItem* init_temp_symbol(SymbolTable* symbol_table, InstructionTable *instruction_table, int constant);
void write_print(InstructionTable *instruction_table, SymbolItem *src);
int update_jmf(InstructionTable *table, int address);
int write_jmf(InstructionTable *table, SymbolItem* cond);
const SymbolItem* write_not_condition(SymbolTable* symbol_table, InstructionTable *table, const SymbolItem* cond);
const SymbolItem* write_condition(SymbolTable* symbol_table, InstructionTable *table, Condition* op, SymbolItem* cond1, SymbolItem* cond2);
#endif //COMPILATOR_2000_YACC_UTIL_H