-
Notifications
You must be signed in to change notification settings - Fork 1
/
smtlib2abstractparser_private.h
189 lines (162 loc) · 8.82 KB
/
smtlib2abstractparser_private.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
/* -*- C -*-
*
* Private interface to the abstract parser for the SMT-LIB v2 language
*
* Author: Alberto Griggio <[email protected]>
*
* Copyright (C) 2010 Alberto Griggio
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
#ifndef SMTLIB2ABSTRACTPARSER_PRIVATE_H_INCLUDED
#define SMTLIB2ABSTRACTPARSER_PRIVATE_H_INCLUDED
#include "smtlib2abstractparser.h"
#include "smtlib2scanner.h"
typedef enum {
SMTLIB2_RESPONSE_SUCCESS,
SMTLIB2_RESPONSE_ERROR,
SMTLIB2_RESPONSE_UNSUPPORTED,
SMTLIB2_RESPONSE_STATUS,
SMTLIB2_RESPONSE_INFO,
SMTLIB2_RESPONSE_UNSATCORE,
SMTLIB2_RESPONSE_MODEL
} smtlib2_response;
typedef enum {
SMTLIB2_STATUS_UNKNOWN,
SMTLIB2_STATUS_UNSAT,
SMTLIB2_STATUS_SAT
} smtlib2_status;
/**
* An abstract SMT-LIB 2 parser, providing functionalities for parsing terms
*/
struct smtlib2_abstract_parser {
smtlib2_parser_interface parent_;
smtlib2_term_parser *termparser_;
FILE *outstream_;
FILE *errstream_;
smtlib2_response response_;
bool print_success_;
char *pvt_errmsg_;
smtlib2_vector *errors_;
smtlib2_vector *response_data_;
smtlib2_status status_;
bool set_logic_ok_;
bool exiting_;
smtlib2_hashtable *info_;
smtlib2_vector *internal_parsed_terms_;
bool internal_parsed_terms_enabled_;
smtlib2_scanner *scanner_;
};
void smtlib2_abstract_parser_set_logic(smtlib2_parser_interface *p,
const char *logic);
void smtlib2_abstract_parser_declare_sort(smtlib2_parser_interface *p,
const char *sortname,
int arity);
void smtlib2_abstract_parser_define_sort(smtlib2_parser_interface *p,
const char *sortname,
smtlib2_vector *params,
smtlib2_sort sort);
void smtlib2_abstract_parser_push_sort_param_scope(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_pop_sort_param_scope(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_declare_function(smtlib2_parser_interface *p,
const char *name,
smtlib2_sort sort);
void smtlib2_abstract_parser_declare_variable(smtlib2_parser_interface *p,
const char *name,
smtlib2_sort sort);
void smtlib2_abstract_parser_define_function(smtlib2_parser_interface *p,
const char *name,
smtlib2_vector *params,
smtlib2_sort sort,
smtlib2_term term);
void smtlib2_abstract_parser_push(smtlib2_parser_interface *p, int n);
void smtlib2_abstract_parser_pop(smtlib2_parser_interface *p, int n);
void smtlib2_abstract_parser_assert_formula(smtlib2_parser_interface *p,
smtlib2_term term);
void smtlib2_abstract_parser_check_sat(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_get_unsat_core(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_get_proof(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_set_str_option(smtlib2_parser_interface *p,
const char *keyword,
const char *value);
void smtlib2_abstract_parser_set_int_option(smtlib2_parser_interface *p,
const char *keyword,
int value);
void smtlib2_abstract_parser_set_rat_option(smtlib2_parser_interface *p,
const char *keyword,
double value);
void smtlib2_abstract_parser_get_info(smtlib2_parser_interface *p,
const char *keyword);
void smtlib2_abstract_parser_set_info(smtlib2_parser_interface *p,
const char *keyword,
const char *value);
void smtlib2_abstract_parser_get_assignment(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_get_assertions(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_get_value(smtlib2_parser_interface *p,
smtlib2_vector *terms);
void smtlib2_abstract_parser_get_model(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_exit(smtlib2_parser_interface *p);
void smtlib2_abstract_parser_set_internal_parsed_terms(
smtlib2_parser_interface *p,
smtlib2_vector *terms);
void smtlib2_abstract_parser_handle_error(smtlib2_parser_interface *p,
const char *msg);
void smtlib2_abstract_parser_push_let_scope(smtlib2_parser_interface *p);
smtlib2_term smtlib2_abstract_parser_pop_let_scope(smtlib2_parser_interface *p);
smtlib2_term smtlib2_abstract_parser_push_quantifier_scope(smtlib2_parser_interface *p);
smtlib2_term smtlib2_abstract_parser_pop_quantifier_scope(smtlib2_parser_interface *p);
smtlib2_term smtlib2_abstract_parser_make_term(smtlib2_parser_interface *p,
const char *symbol,
smtlib2_sort sort,
smtlib2_vector *index,
smtlib2_vector *args);
smtlib2_term smtlib2_abstract_parser_make_number_term(
smtlib2_parser_interface *p,
const char *numval,
int width,
int base);
smtlib2_term smtlib2_abstract_parser_make_forall_term(
smtlib2_parser_interface *p,
smtlib2_term term
);
smtlib2_term smtlib2_abstract_parser_make_exists_term(
smtlib2_parser_interface *p,
smtlib2_term term
);
void smtlib2_abstract_parser_annotate_term(smtlib2_parser_interface *p,
smtlib2_term term,
smtlib2_vector *annotations);
void smtlib2_abstract_parser_define_let_binding(smtlib2_parser_interface *p,
const char *symbol,
smtlib2_term term);
smtlib2_sort smtlib2_abstract_parser_make_sort(smtlib2_parser_interface *p,
const char *sortname,
smtlib2_vector *index);
smtlib2_sort smtlib2_abstract_parser_make_parametric_sort(
smtlib2_parser_interface *p,
const char *name,
smtlib2_vector *tps);
smtlib2_sort smtlib2_abstract_parser_make_function_sort(
smtlib2_parser_interface *p,
smtlib2_vector *tps);
void smtlib2_abstract_parser_print_response(smtlib2_abstract_parser *p);
void smtlib2_abstract_parser_reset_response(smtlib2_abstract_parser *p);
void smtlib2_abstract_parser_set_errorv(smtlib2_abstract_parser *p, const char *fmt, va_list args);
void smtlib2_abstract_parser_set_error(smtlib2_abstract_parser *p, const char *fmt, ...);
#endif /* SMTLIB2ABSTRACTPARSER_PRIVATE_H_INCLUDED */