Adding Parser::setInput and using it in InteractiveShell (Fixes: #225)
[cvc5.git] / src / main / interactive_shell.h
1 /********************* */
2 /*! \file interactive_shell.h
3 ** \verbatim
4 ** Original author: cconway
5 ** Major contributors:
6 ** Minor contributors (to current version):
7 ** This file is part of the CVC4 prototype.
8 ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys)
9 ** Courant Institute of Mathematical Sciences
10 ** New York University
11 ** See the file COPYING in the top-level source directory for licensing
12 ** information.\endverbatim
13 **
14 ** \brief Interactive shell for CVC4
15 **/
16
17 #ifndef __CVC4__INTERACTIVE_SHELL_H
18 #define __CVC4__INTERACTIVE_SHELL_H
19
20 #include <iostream>
21 #include <string>
22
23 #include "parser/parser_builder.h"
24 #include "util/language.h"
25 #include "util/options.h"
26
27 namespace CVC4 {
28
29 class Command;
30
31 using namespace parser;
32
33 class CVC4_PUBLIC InteractiveShell {
34 std::istream& d_in;
35 std::ostream& d_out;
36 Parser* d_parser;
37 const InputLanguage d_language;
38
39 static const std::string INPUT_FILENAME;
40
41 public:
42 InteractiveShell(ExprManager& exprManager,
43 const Options& options) :
44 d_in(*options.in),
45 d_out(*options.out),
46 d_language(options.inputLanguage) {
47 ParserBuilder parserBuilder(exprManager,INPUT_FILENAME,options);
48 /* Create parser with bogus input. */
49 d_parser = parserBuilder.withStringInput("").build();
50 }
51
52 /** Read a command from the interactive shell. This will read as
53 many lines as necessary to parse a well-formed command. */
54 Command *readCommand();
55 };
56
57 } // CVC4 namespace
58
59 #endif // __CVC4__INTERACTIVE_SHELL_H