/* * This file is part of the Yices SMT Solver. * Copyright (C) 2017 SRI International. * * Yices is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * Yices is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Yices. If not, see . */ PARSER FOR SMT-LIB 2.0 We don't care about the logic and theory part of SMT LIB 2.0. We just need to parse SMT-LIB 2.0 scripts. Tokens ------ They are defined in smt2_lexer.h: enum smt2_token { // open/close par SMT2_TK_LP, SMT2_TK_RP, // end of stream SMT2_TK_EOS, // atomic tokens SMT2_TK_NUMERAL, SMT2_TK_DECIMAL, SMT2_TK_HEXADECIMAL, SMT2_TK_BINARY, SMT2_TK_STRING, SMT2_TK_SYMBOL, SMT2_TK_QSYMBOL, SMT2_TK_KEYWORD, // Reserved words SMT2_TK_PAR, SMT2_TK_NUM, SMT2_TK_DEC, SMT2_TK_STR, SMT2_TK_UNDERSCORE, SMT2_TK_BANG, SMT2_TK_AS, SMT2_TK_LET, SMT2_TK_EXISTS, SMT2_TK_FORALL, // Commands SMT2_TK_ASSERT, SMT2_TK_CHECK_SAT, SMT2_TK_CHECK_SAT_ASSUMING, SMT2_TK_CHECK_SAT_ASSUMING_MODEL, SMT2_TK_DECLARE_SORT, SMT2_TK_DECLARE_CONST, SMT2_TK_DECLARE_FUN, SMT2_TK_DEFINE_SORT, SMT2_TK_DEFINE_CONST, SMT2_TK_DEFINE_FUN, SMT2_TK_EXIT, SMT2_TK_GET_ASSERTIONS, SMT2_TK_GET_ASSIGNMENT, SMT2_TK_GET_INFO, SMT2_TK_GET_MODEL, SMT2_TK_GET_OPTION, SMT2_TK_GET_PROOF, SMT2_TK_GET_UNSAT_CORE, SMT2_TK_GET_MODEL_INTERPOLANT, SMT2_TK_GET_VALUE, SMT2_TK_POP, SMT2_TK_PUSH, SMT2_TK_SET_LOGIC, SMT2_TK_SET_INFO, SMT2_TK_SET_OPTION, SMT2_TK_ECHO, SMT2_TK_RESET, SMT2_TK_RESET_ASSERTIONS, // Errors SMT2_TK_INVALID_STRING, SMT2_TK_INVALID_NUMERAL, SMT2_TK_INVALID_DECIMAL, SMT2_TK_INVALID_HEXADECIMAL, SMT2_TK_INVALID_BINARY, SMT2_TK_INVALID_SYMBOL, SMT2_TK_INVALID_KEYWORD, SMT2_TK_ERROR, } Grammar (SMT-LIB 2.5, June 28 2015) ---------------------------------------- ::= ( set-logic ) | ( set-option