No Description
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.

table_symboles.h 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* TABLE DES SYMBOLE DU COMPILATEUR (PILE)
  2. -----------------------------------------------------
  3. | symbole | adresse | type | initialisé |
  4. -----------------------------------------------------
  5. | | | | |
  6. | | | | |
  7. | | | | |
  8. | i | 0x777756b8 | int | false |
  9. | size | 0x777756b8 | int | true |
  10. -----------------------------------------------------
  11. Types pour l'implémentation :
  12. - enum type_t : [int]
  13. - struct symbole : {
  14. char nom[30];
  15. uintptr_t adresse;
  16. enum type_t type;
  17. char initialized;
  18. }
  19. Opérations possible :
  20. - init -> pile * -> void
  21. - push -> symbole -> pile * -> void
  22. - pop -> pile * -> symbole
  23. - status -> nom -> pile -> char */
  24. #include <stdint.h>
  25. enum type_t {UNKNOWN, INT};
  26. struct symbole_t {
  27. char nom[30];
  28. uintptr_t adresse;
  29. enum type_t type;
  30. char initialized;
  31. };
  32. struct pile_t;
  33. void init(struct pile_t * pile);
  34. void push(struct symbole_t symbole, struct pile_t * pile);
  35. struct symbole_t pop(struct pile_t * pile);
  36. // renvoi 0 si nom n'existe pas, 2 si nom existe sans etre initialisée, 1 sinon
  37. char status(char * nom, struct pile_t pile);
  38. void print(struct pile_t pile);