Year 2 compilers coureswork

types.h 745B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef TYPES_H
  2. #define TYPES_H
  3. #include "nodes.h"
  4. typedef struct binding {
  5. TOKEN* name;
  6. int env_offset;
  7. int is_saved;
  8. struct environ *env;
  9. } BIND;
  10. typedef struct blist {
  11. BIND* binding;
  12. struct blist *next;
  13. } BLIST;
  14. typedef struct environ {
  15. int return_addr;
  16. BLIST *bindings;
  17. struct environ *parent;
  18. struct environ *previous;
  19. int counter;
  20. int param_counter;
  21. int arg_counter;
  22. } ENV;
  23. typedef struct tac_elem {
  24. TOKEN* src;
  25. TOKEN* dst;
  26. TOKEN* tgt;
  27. int op;
  28. } TAC_T;
  29. typedef struct tac_list {
  30. TAC_T* elem;
  31. struct tac_list* next;
  32. } TLIST;
  33. typedef struct tacs {
  34. TLIST* list;
  35. } TACS;
  36. typedef struct reg {
  37. int num;
  38. int stored;
  39. } REG;
  40. typedef struct varloc {
  41. TOKEN* var;
  42. int loc_idx;
  43. } VARLOC;
  44. #endif