OPAL (Object Oriented Parallel Accelerator Library)  2021.1.99
OPAL
Parser.h
Go to the documentation of this file.
1 #ifndef CLASSIC_Parser_HH
2 #define CLASSIC_Parser_HH
3 
4 // ------------------------------------------------------------------------
5 // $RCSfile: Parser.h,v $
6 // ------------------------------------------------------------------------
7 // $Revision: 1.1.1.1 $
8 // ------------------------------------------------------------------------
9 // Copyright: see Copyright.readme
10 // ------------------------------------------------------------------------
11 //
12 // Class: Parser
13 //
14 // ------------------------------------------------------------------------
15 // Class category: Parser
16 // ------------------------------------------------------------------------
17 //
18 // $Date: 2000/03/27 09:32:37 $
19 // $Author: fci $
20 //
21 // ------------------------------------------------------------------------
22 
23 class Statement;
24 class TokenStream;
25 
26 
27 // Class Parser
28 // ------------------------------------------------------------------------
30 
31 class Parser {
32 
33 public:
34 
35  Parser();
36  virtual ~Parser();
37 
39  virtual void parse(Statement &stat) const = 0;
40 
42  virtual Statement *readStatement(TokenStream *ts) const = 0;
43 
45  // Read one statement at a time on token stream, parse it, and execute it.
46  virtual void run(TokenStream *ts) const = 0;
47 
48 private:
49 
50  // Not implemented.
51  Parser(const Parser &);
52  void operator=(const Parser &);
53 };
54 
55 inline
57 { }
58 
59 inline
61 { }
62 
63 #endif // CLASSIC_Parser_HH
Interface for abstract language parser.
Definition: Parser.h:31
virtual void parse(Statement &stat) const =0
Parse and execute the statement.
Parser()
Definition: Parser.h:56
virtual Statement * readStatement(TokenStream *ts) const =0
Read complete statement from token stream.
virtual ~Parser()
Definition: Parser.h:60
virtual void run(TokenStream *ts) const =0
Read statements and parse.
Parser(const Parser &)
void operator=(const Parser &)
Interface for statements.
Definition: Statement.h:38
Abstract interface for a stream of input tokens.
Definition: TokenStream.h:33