12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- #ifndef COMPILATOR_2000_ASM_INSTRUCTIONS_H
- #define COMPILATOR_2000_ASM_INSTRUCTIONS_H
-
- #include <stdio.h>
- #include "symbol_table.h"
-
- #define INSTRUCTION_TABLE_SIZE 100
-
- typedef enum Instruction {
- ADD,
- MUL,
- SOU,
- DIV,
- COP,
- AFC,
- JMP,
- JMF,
- INF,
- SUP,
- EQU,
- PRI
- } Instruction;
-
- extern char* instructions_labels[];
-
-
- typedef struct InstructionItem {
- Instruction instruction;
- int arg1;
- int arg2;
- int arg3;
- } InstructionItem;
-
- typedef struct InstructionTable {
- InstructionItem table[INSTRUCTION_TABLE_SIZE];
- int index;
- } InstructionTable;
-
- void init_instruction_table(InstructionTable *table);
-
- int add_instruction(InstructionTable *table, Instruction instruction, int arg1, int arg2, int arg3);
-
- void write_instruction_table(InstructionTable *table, FILE *file);
-
- void write_instruction(InstructionItem *item, FILE *file);
-
- int get_current_address(InstructionTable *table);
-
- #endif //COMPILATOR_2000_ASM_INSTRUCTIONS_H
|