canezzy

common.h

Mar 27th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.94 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <string>
  4.  
  5. /**
  6.  * State symbol definitions
  7.  */
  8. #define IDLE_STATE              0
  9. #define START_STATE             1
  10. #define INVALID_STATE           (-2)
  11.  
  12. /**
  13.  * Use these definitions for easily addressing "human type" matrix
  14.  */
  15. #define A 10
  16. #define B 11
  17. #define C 12
  18. #define D 13
  19. #define E 14
  20. #define F 15
  21. #define G 16
  22. #define H 17
  23. #define I 18
  24. #define J 19
  25. #define K 20
  26. #define R 21
  27. #define M 22
  28. #define N 23
  29. #define O 24
  30. #define P 25
  31.  
  32. /**
  33.  * Number of states in FSM
  34.  */
  35. #define NUM_STATE               (P+1)
  36.  
  37. /**
  38.  * Number of supported characters
  39.  */
  40. #define NUM_OF_CHARACTERS       46
  41.  
  42. /**
  43. * Supported token types.
  44. */
  45. typedef enum TokenType
  46. {
  47.     T_NO_TYPE,
  48.     T_COMMENT,
  49.     T_ID,
  50.     T_NUM,
  51.     T_REAL,
  52.     T_IF,
  53.     T_THEN,
  54.     T_ELSE,
  55.     T_PLUS,
  56.     T_MINUS,
  57.     T_EQ,
  58.     T_SEMI,
  59.     T_WHITE_SPACE,
  60.     T_ERROR,
  61.     T_EQEQ,
  62.     T_DEC,
  63.     T_END_OF_FILE
  64. };
  65.  
  66. /**
  67.  * Alignment definitions for nice printing
  68.  */
  69. #define LEFT_ALIGN              20
  70. #define RIGHT_ALIGN             25
Add Comment
Please, Sign In to add comment