Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Andrew Reynolds 4 : : * 5 : : * This file is part of the cvc5 project. 6 : : * 7 : : * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS 8 : : * in the top-level source directory and their institutional affiliations. 9 : : * All rights reserved. See the file COPYING in the top-level source 10 : : * directory for licensing information. 11 : : * **************************************************************************** 12 : : * 13 : : * The flex smt2 parser. 14 : : */ 15 : : 16 : : #include "cvc5parser_public.h" 17 : : 18 : : #ifndef CVC5__PARSER__SMT2__SMT2_PARSER_H 19 : : #define CVC5__PARSER__SMT2__SMT2_PARSER_H 20 : : 21 : : #include <cvc5/cvc5.h> 22 : : 23 : : #include "parser/parser.h" 24 : : #include "parser/smt2/smt2_state.h" 25 : : #include "parser/smt2/smt2_cmd_parser.h" 26 : : #include "parser/smt2/smt2_lexer.h" 27 : : #include "parser/smt2/smt2_term_parser.h" 28 : : 29 : : namespace cvc5 { 30 : : namespace parser { 31 : : 32 : : /** 33 : : * smt2 parser. It maintains a lexer, a state, a term parser and a 34 : : * command parser. The latter two are used for parsing terms and commands. The 35 : : * command parser depends on the term parser. 36 : : */ 37 : : class Smt2Parser : public Parser 38 : : { 39 : : public: 40 : : Smt2Parser(Solver* solver, 41 : : SymManager* sm, 42 : : ParsingMode parsingMode = ParsingMode::DEFAULT, 43 : : bool isSygus = false); 44 : 45912 : virtual ~Smt2Parser() {} 45 : : /** Set the logic */ 46 : : void setLogic(const std::string& logic) override; 47 : : 48 : : protected: 49 : : /** 50 : : * Parse and return the next command. Will initialize the logic to "ALL" 51 : : * or the forced logic if no logic is set prior to this point and a command 52 : : * is read that requires initializing the logic. 53 : : */ 54 : : std::unique_ptr<Cmd> parseNextCommand() override; 55 : : 56 : : /** 57 : : * Parse and return the next term. Requires setting the logic 58 : : * beforehand. 59 : : */ 60 : : Term parseNextTerm() override; 61 : : /** The lexer */ 62 : : Smt2Lexer d_slex; 63 : : /** The state */ 64 : : Smt2State d_state; 65 : : /** Term parser */ 66 : : Smt2TermParser d_termParser; 67 : : /** Command parser */ 68 : : Smt2CmdParser d_cmdParser; 69 : : }; 70 : : 71 : : } // namespace parser 72 : : } // namespace cvc5 73 : : 74 : : #endif /* CVC5__PARSER__SMT2_H */