token.h 365 B

123456789101112131415161718192021222324252627
  1. #include<stdio.h>
  2. #define MAX_TOKEN_WIDTH 16
  3. // token的类型
  4. typedef enum
  5. {
  6. NULL_TOKEN,
  7. NUM,
  8. ADD,
  9. SUB,
  10. MUL,
  11. DIV,
  12. END,
  13. LB, // 括号:brackets,LB是左(left)括号
  14. RB, // 右(right)括号
  15. STOP,
  16. EXIT,
  17. } token_type;
  18. typedef struct
  19. {
  20. token_type type;
  21. double NUMBER;
  22. char str[MAX_TOKEN_WIDTH];
  23. } Token;