Extracted the public Expr and ExprManager interface to encapsulate the optimized...
[cvc5.git] / src / parser / parser.h
1 /********************* -*- C++ -*- */
2 /** parser.h
3 ** This file is part of the CVC4 prototype.
4 ** Copyright (c) 2009 The Analysis of Computer Systems Group (ACSys)
5 ** Courant Institute of Mathematical Sciences
6 ** New York University
7 ** See the file COPYING in the top-level source directory for licensing
8 ** information.
9 **
10 ** Parser abstraction.
11 **/
12
13 #ifndef __CVC4__PARSER__PARSER_H
14 #define __CVC4__PARSER__PARSER_H
15
16 #include <string>
17 #include <iostream>
18 #include <fstream>
19 #include "cvc4_config.h"
20 #include "parser_exception.h"
21
22 namespace CVC4 {
23
24 // Forward declarations
25 class Expr;
26 class Command;
27 class ExprManager;
28
29 namespace parser {
30
31 class AntlrSmtLexer;
32 class AntlrSmtParser;
33 class AntlrCvcLexer;
34 class AntlrCvcParser;
35
36 /**
37 * The parser.
38 */
39 class CVC4_PUBLIC Parser {
40
41 public:
42
43 /**
44 * Construct the parser that uses the given expression manager.
45 * @param em the expression manager.
46 */
47 Parser(ExprManager* em);
48
49 /**
50 * Destructor.
51 */
52 virtual ~Parser() {
53 }
54
55 /**
56 * Parse the next command of the input
57 */
58 virtual Command* parseNextCommand() throw (ParserException) = 0;
59
60 /**
61 * Parse the next expression of the stream
62 */
63 virtual Expr parseNextExpression() throw (ParserException) = 0;
64
65 /**
66 * Check if we are done -- either the end of input has been reached.
67 */
68 bool done() const;
69
70 protected:
71
72 /** Sets the done flag */
73 void setDone(bool done = true);
74
75 /** Expression manager the parser will be using */
76 ExprManager* d_expr_manager;
77
78 /** Are we done */
79 bool d_done;
80
81 }; // end of class Parser
82
83 }/* CVC4::parser namespace */
84 }/* CVC4 namespace */
85
86 #endif /* __CVC4__PARSER__PARSER_H */