1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef COMPILATOR_2000_ASM_INSTRUCTIONS_H
- #define COMPILATOR_2000_ASM_INSTRUCTIONS_H
-
- #include <stdio.h>
-
- #define INSTRUCTION_TABLE_SIZE 100
-
- typedef enum Instruction {
- ADD,
- MUL,
- SUO,
- DIV,
- COP,
- AFC,
- JMP,
- JMF,
- INF,
- SUP,
- EQU,
- PRI
- } Instruction;
-
- char* instructions_labels[12] = {
- "ADD",
- "MUL",
- "SUO",
- "DIV",
- "COP",
- "AFC",
- "JMP",
- "JMF",
- "INF",
- "SUP",
- "EQU",
- "PRI"
- };
-
-
- 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);
-
- #endif //COMPILATOR_2000_ASM_INSTRUCTIONS_H
|