additional work on parser hookup, configuration + build
[cvc5.git] / src / parser / parser.cpp
1 /********************* -*- C++ -*- */
2 /** parser.cpp
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 implementation.
11 **/
12
13 #include "parser/parser.h"
14 #include "parser/parser_state.h"
15 #include "parser/parser_exception.h"
16 #include "parser/pl.hpp"
17 //#include "parser/smtlib.hpp"
18
19 // The communication entry points of the actual parsers
20
21 // for presentation language (PL.y and PL.lex)
22 extern int PLparse();
23 extern void *PL_createBuffer(int);
24 extern void PL_deleteBuffer(void *);
25 extern void PL_switchToBuffer(void *);
26 extern int PL_bufSize();
27 extern void *PL_bufState();
28 void PL_setInteractive(bool);
29
30 // for smtlib language (smtlib.y and smtlib.lex)
31 extern int smtlibparse();
32 extern void *smtlib_createBuffer(int);
33 extern void smtlib_deleteBuffer(void *);
34 extern void smtlib_switchToBuffer(void *);
35 extern int smtlib_bufSize();
36 extern void *smtlibBufState();
37 void smtlib_setInteractive(bool);
38
39 namespace CVC4 {
40 namespace parser {
41
42 ParserState *parserState;
43
44 Parser::Parser(CVC4::SmtEngine* smt, Language lang, std::istream& is, CVC4::Options* opts, bool interactive) throw()
45 : d_smt(smt),
46 d_is(is),
47 d_opts(opts),
48 d_lang(lang),
49 d_interactive(interactive),
50 d_buffer(0) {
51
52 parserState->lineNum = 1;
53 switch(d_lang) {
54 case PL:
55 d_buffer = ::PL_createBuffer(::PL_bufSize());
56 break;
57 case SMTLIB:
58 //d_buffer = ::smtlib_createBuffer(::smtlib_bufSize());
59 break;
60 default:
61 Unhandled();
62 }
63 }
64
65 Parser::~Parser() throw() {
66 switch(d_lang) {
67 case PL:
68 ::PL_deleteBuffer(d_buffer);
69 break;
70 case SMTLIB:
71 //::smtlib_deleteBuffer(d_buffer);
72 break;
73 default:
74 Unhandled();
75 }
76 }
77
78 CVC4::Command* Parser::next() throw() {
79 return 0;
80 }
81
82 bool Parser::done() const throw() {
83 return false;
84 }
85
86 void Parser::printLocation(std::ostream & out) const throw() {
87 }
88
89 void Parser::reset() throw() {
90 }
91
92
93 }/* CVC4::parser namespace */
94 }/* CVC4 namespace */