13 template<
typename Pol>
14 struct FormulaParser:
public qi::grammar<Iterator, Formula<Pol>(), Skipper> {
26 varname = qi::lexeme[ (qi::alpha | qi::char_(
"~!@$%^&*_+=<>.?/-")) > *(qi::alnum | qi::char_(
"~!@$%^&*_+=<>.?/-"))];
40 | qi::eps[qi::_val = qi::_a]
79 subFormulas.push_back( first );
80 for (
const auto& subop: ops) {
83 subFormulas.push_back( subop );
91 subFormulas.push_back( first );
92 for (
const auto& subop: ops) {
95 subFormulas.push_back( subop );
107 assert(!ops.empty());
111 subFormulas.push_back( first );
112 for (
const auto& op: ops) {
115 subFormulas.push_back( op );
123 assert(!ops.empty());
127 subFormulas.push_back( first );
128 for (
const auto& op: ops) {
131 subFormulas.push_back( op );
MultivariatePolynomial< Rational > Pol
FormulaType
Represent the type of a formula to allow faster/specialized processing.
std::vector< Formula< Poly > > Formulas
Variable fresh_boolean_variable() noexcept
boost::spirit::qi::space_type Skipper
std::string::const_iterator Iterator
A Variable represents an algebraic variable that can be used throughout carl.
static VariablePool & getInstance()
Returns the single instance of this class by reference.
Represent an SMT formula, which can be an atom for some background theory or a boolean combination of...
qi::rule< Iterator, Variable(), Skipper > variable
void addVariable(Variable::Arg v)
qi::symbols< char, Variable > varmap
qi::rule< Iterator, Formula< Pol >), Skipper, qi::locals< Formula< Pol > > > formula_op
qi::rule< Iterator, Formula< Pol >), Skipper > formula
Formula< Pol > createBinary(FormulaType op, const Formula< Pol > &lhs, const Formula< Pol > &rhs)
qi::rule< Iterator, std::string(), Skipper > varname
qi::symbols< char, FormulaType > binaryop
qi::rule< Iterator, Formula< Pol >), Skipper > main
Formula< Pol > createNary(FormulaType op, const Formula< Pol > &first, const std::vector< Formula< Pol >> &ops)
Formula< Pol > mkOr(const Formula< Pol > &first, const std::vector< Formula< Pol >> &ops)
Formula< Pol > mkAnd(const Formula< Pol > &first, const std::vector< Formula< Pol >> &ops)
qi::symbols< char, FormulaType > naryop
Variable newVariable(const std::string &s)