le compilateur super performant
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

asm_instructions.h 948B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef COMPILATOR_2000_ASM_INSTRUCTIONS_H
  2. #define COMPILATOR_2000_ASM_INSTRUCTIONS_H
  3. #include <stdio.h>
  4. #define INSTRUCTION_TABLE_SIZE 100
  5. typedef enum Instruction {
  6. ADD,
  7. MUL,
  8. SOU,
  9. DIV,
  10. COP,
  11. AFC,
  12. JMP,
  13. JMF,
  14. INF,
  15. SUP,
  16. EQU,
  17. PRI
  18. } Instruction;
  19. char* instructions_labels[12];
  20. typedef struct InstructionItem {
  21. Instruction instruction;
  22. int arg1;
  23. int arg2;
  24. int arg3;
  25. } InstructionItem;
  26. typedef struct InstructionTable {
  27. InstructionItem table[INSTRUCTION_TABLE_SIZE];
  28. int index;
  29. } InstructionTable;
  30. void init_instruction_table(InstructionTable *table);
  31. int add_instruction(InstructionTable *table, Instruction instruction, int arg1, int arg2, int arg3);
  32. void write_instruction_table(InstructionTable *table, FILE *file);
  33. void write_instruction(InstructionItem *item, FILE *file);
  34. #endif //COMPILATOR_2000_ASM_INSTRUCTIONS_H