1 //********************************************************** 2 // CR_PARSE.HPP 3 // Coco/R C++ Support Library. 4 // Author: Frankie Arzu <farzu@uvg.edu.gt> 5 // 6 // Jun 12, 1996 Version 1.06 7 // Many fixes and suggestions thanks to 8 // Pat Terry <p.terry@.ru.ac.za> 9 // Jun 20, 2001 10 // Virtual destructors added 11 //********************************************************** 12 13 #ifndef CR_PARSER_H 14 #define CR_PARSER_H 15 16 #include "cr_abs.hpp" 17 #include "cr_error.hpp" 18 19 class CRParser { 20 // Abstract Parser 21 public: 22 CRParser(AbsScanner *S = NULL, CRError *E = NULL); 23 // Constructs abstract parser, and associates it with scanner S and 24 // customized error reporter E 25 ~CRParser()26 virtual ~CRParser() { } 27 28 void Parse(); 29 // Abstract parser 30 31 void SynError(int ErrorNo); 32 // Records syntax error ErrorNo 33 34 void SemError(int ErrorNo); 35 // Records semantic error ErrorNo 36 37 protected: 38 virtual void Get() = 0; 39 int In(unsigned short int *SymbolSet, int i); 40 void Expect(int n); 41 void GenError(int ErrorNo); 42 AbsScanner *Scanner; 43 CRError *Error; 44 int Sym; 45 }; 46 47 #endif // CR_PARSER_H 48 49