Year 2 compilers coureswork

types.h 622B

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