Tuesday end-of-day commit.
[cvc5.git] / src / parser / cvc / cvc_input.h
1 /********************* */
2 /*! \file cvc_input.h
3 ** \verbatim
4 ** Original author: cconway
5 ** Major contributors: mdeters
6 ** Minor contributors (to current version): none
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 [[ Add file-specific comments here ]].
15 **
16 ** [[ Add file-specific comments here ]]
17 **/
18
19 #include "cvc4parser_private.h"
20
21 #ifndef __CVC4__PARSER__CVC_INPUT_H
22 #define __CVC4__PARSER__CVC_INPUT_H
23
24 #include "parser/antlr_input.h"
25 #include "parser/cvc/generated/CvcLexer.h"
26 #include "parser/cvc/generated/CvcParser.h"
27
28 // extern void CvcParserSetAntlrParser(CVC4::parser::AntlrParser* newAntlrParser);
29
30 namespace CVC4 {
31
32 class Command;
33 class Expr;
34 class ExprManager;
35
36 namespace parser {
37
38 class CvcInput : public AntlrInput {
39 /** The ANTLR3 CVC lexer for the input. */
40 pCvcLexer d_pCvcLexer;
41
42 /** The ANTLR3 CVC parser for the input. */
43 pCvcParser d_pCvcParser;
44
45 public:
46
47 /** Create an input.
48 *
49 * @param inputStream the input to parse
50 */
51 CvcInput(AntlrInputStream& inputStream);
52
53 /** Destructor. Frees the lexer and the parser. */
54 ~CvcInput();
55
56 /** Get the language that this Input is reading. */
57 InputLanguage getLanguage() const throw() {
58 return language::input::LANG_CVC4;
59 }
60
61 protected:
62
63 /** Parse a command from the input. Returns <code>NULL</code> if there is
64 * no command there to parse.
65 *
66 * @throws ParserException if an error is encountered during parsing.
67 */
68 Command* parseCommand()
69 throw(ParserException, TypeCheckingException, AssertionException);
70
71 /** Parse an expression from the input. Returns a null <code>Expr</code>
72 * if there is no expression there to parse.
73 *
74 * @throws ParserException if an error is encountered during parsing.
75 */
76 Expr parseExpr()
77 throw(ParserException, TypeCheckingException, AssertionException);
78
79 private:
80
81 /** Initialize the class. Called from the constructors once the input stream
82 * is initialized. */
83 void init();
84
85 }; // class CvcInput
86
87 }/* CVC4::parser namespace */
88 }/* CVC4 namespace */
89
90 #endif /* __CVC4__PARSER__CVC_INPUT_H */