Ablparse.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. //===========================================================================//
  2. // Copyright (C) Microsoft Corporation. All rights reserved. //
  3. //===========================================================================//
  4. //***************************************************************************
  5. //
  6. // PARSER.H
  7. //
  8. //***************************************************************************
  9. #ifndef ABLPARSE_H
  10. #define ABLPARSE_H
  11. #ifndef ABLGEN_H
  12. #include "ablgen.h"
  13. #endif
  14. #ifndef ABLSYMT_H
  15. #include "ablsymt.h"
  16. #endif
  17. #ifndef ABLERR_H
  18. #include "ablerr.h"
  19. #endif
  20. //***************************************************************************
  21. typedef enum {
  22. USE_EXPR,
  23. USE_TARGET,
  24. USE_REFPARAM
  25. } UseType;
  26. typedef enum {
  27. BLOCK_MODULE,
  28. BLOCK_ROUTINE
  29. } BlockType;
  30. //***************************************************************************
  31. //----------
  32. // FUNCTIONS
  33. TypePtr expression (void);
  34. TypePtr variable (SymTableNodePtr variableIdPtr);
  35. TypePtr arraySubscriptList (TypePtr typePtr);
  36. //TypePtr routineCall (SymTableNodePtr routineIdPtr, BOOL parmCheckFlag);
  37. void checkRelationalOpTypes (TypePtr type1, TypePtr type2);
  38. long isAssignTypeCompatible (TypePtr type1, TypePtr type2);
  39. void ifTokenGet (TokenCodeType tokenCode);
  40. void ifTokenGetElseError (TokenCodeType tokenCode, SyntaxErrorType errCode);
  41. // DECL routines
  42. void declarations (SymTableNodePtr routineIdPtr, bool allowFunctions);
  43. void constDefinitions (void);
  44. void doConst (SymTableNodePtr constantIdPtr);
  45. void varDeclarations (SymTableNodePtr routineIdPtr);
  46. void varOrFieldDeclarations (SymTableNodePtr routineIdPtr, long offset);
  47. void typeDefinitions (void);
  48. TypePtr doType (void);
  49. TypePtr identifierType (SymTableNodePtr idPtr);
  50. TypePtr enumerationType (void);
  51. TypePtr subrangeType (void);
  52. TypePtr arrayType (void);
  53. long arraySize (TypePtr typePtr);
  54. TypePtr makeStringType (long length);
  55. // ROUTINE functions
  56. void module (void);
  57. SymTableNodePtr moduleHeader (void);
  58. void routine (void);
  59. SymTableNodePtr functionHeader (void);
  60. SymTableNodePtr formalParamList (long* count, long* totalSize);
  61. TypePtr routineCall (SymTableNodePtr routineIdPtr, long paramCheckFlag);
  62. TypePtr declaredRoutineCall (SymTableNodePtr routineIdPtr, long paramCheckFlag);
  63. void actualParamList (SymTableNodePtr routineIdPtr, long paramCheckFlag);
  64. void block (SymTableNodePtr routineIdPtr);
  65. // STATEMNT routines
  66. void compoundStatement (void);
  67. void assignmentStatement (SymTableNodePtr varIdPtr);
  68. void repeatStatement (void);
  69. void whileStatement (void);
  70. void ifStatement (void);
  71. void forStatement (void);
  72. void switchStatement (void);
  73. void transStatement (void);
  74. void statement (void);
  75. // STANDARD routines
  76. void stdPrint (void);
  77. TypePtr stdAbs (void);
  78. TypePtr stdRound (void);
  79. TypePtr stdTrunc (void);
  80. TypePtr stdSqrt (void);
  81. TypePtr stdRandom (void);
  82. TypePtr standardRoutineCall (SymTableNodePtr routineIdPtr);
  83. // FILE routines
  84. long openSourceFile (char* sourceFileName);
  85. long closeSourceFile (void);
  86. #if !ANALYZE_ON
  87. #define analyzeConstDefn(idPtr)
  88. #define analyzeVarDecl(idPtr)
  89. #define analyzeTypeDefn(idPtr)
  90. #define analyzeRoutineHeader(idPtr)
  91. #define analyzeBlock(idPtr)
  92. #endif
  93. //***************************************************************************
  94. #endif