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