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 1.0KB

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