12#ifndef MCRL2_PBES_PARSE_H
13#define MCRL2_PBES_PARSE_H
15#include "mcrl2/data/detail/parse_substitution.h"
16#include "mcrl2/pbes/typecheck.h"
17#include "mcrl2/pbes/untyped_pbes.h"
18#include <boost/algorithm/string.hpp>
19#include <boost/algorithm/string/join.hpp>
38 std::string text = utilities::read_text(in);
39 pbes result = detail::parse_pbes_new(text).construct_pbes();
51 result = parse_pbes(from);
58 std::istringstream in(text);
59 return parse_pbes(in);
62template <
typename VariableContainer>
64 const VariableContainer& variables,
69 return typecheck_propositional_variable(result, variables, dataspec);
73
74
75
76
77
78
79
80
81template <
typename VariableContainer,
typename PropositionalVariableContainer>
84 const VariableContainer& variables,
85 const PropositionalVariableContainer& propositional_variables,
86 bool type_check =
true,
87 bool translate_user_notation =
true,
88 bool normalize_sorts =
true
94 x =
pbes_system::typecheck_pbes_expression(x, variables, propositional_variables, dataspec);
96 if (translate_user_notation)
108
109
110
111
112
113
114
115template <
typename VariableContainer>
117 const pbes& pbesspec,
118 const VariableContainer& variables,
119 bool type_check =
true,
120 bool translate_user_notation =
true,
121 bool normalize_sorts =
true
124 std::vector<propositional_variable> propositional_variables;
125 for (
const pbes_equation& eqn: pbesspec.equations())
127 propositional_variables.push_back(eqn.variable());
129 return parse_pbes_expression(text, pbesspec.data(), variables, propositional_variables, type_check, translate_user_notation, normalize_sorts);
The interface for a class that reads aterm from a stream. The default constructed term aterm() indica...
The interface for a class that writes aterm to a stream. Every written term is retrieved by the corre...
A helper class to restore the state of the aterm_{i,o}stream objects upon destruction....
aterm_stream_state(aterm_stream &stream)
A unordered_map class in which aterms can be stored.
data_specification()=default
Default constructor. Generate a data specification that contains only booleans and positive numbers.
function_symbol(const core::identifier_string &name, const sort_expression &sort)
Constructor.
const core::identifier_string & name() const
const sort_expression & sort() const
const pbes_expression & formula() const
Returns the predicate formula on the right hand side of the equation.
pbes_equation(const fixpoint_symbol &symbol, const propositional_variable &variable, const pbes_expression &expr)
Constructor.
const fixpoint_symbol & symbol() const
Returns the fixpoint symbol of the equation.
const propositional_variable & variable() const
Returns the pbes variable of the equation.
pbes_expression & operator=(pbes_expression &&) noexcept=default
parameterized boolean equation system
const propositional_variable_instantiation & initial_state() const
Returns the initial state.
bool is_well_typed() const
Checks if the PBES is well typed.
\brief A propositional variable instantiation
\brief A propositional variable declaration
#define mCRL2log(LEVEL)
mCRL2log(LEVEL) provides the stream used to log.
aterm_istream & operator>>(aterm_istream &stream, aterm &term)
Read the given term from the stream, but for aterm_list we want to use a specific one that performs v...
aterm_istream & operator>>(aterm_istream &stream, aterm_transformer transformer)
Sets the given transformer to be applied to following reads.
atermpp::aterm_istream & operator>>(atermpp::aterm_istream &stream, data_specification &spec)
Reads a data specification from a stream.
bool is_bes(const pbes &x)
Returns true if a PBES is in BES form.
untyped_pbes parse_pbes_new(const std::string &text)
void complete_pbes(pbes &x)
pbes load_pbes(const std::string &filename)
Loads a PBES from filename, or from stdin if filename equals "".
propositional_variable parse_propositional_variable(const std::string &text)
void save_pbes(const pbes &pbesspec, const std::string &filename)
Saves an PBES to filename, or to stdout if filename equals "".
pbes_expression parse_pbes_expression(const std::string &text)
pbes_expression parse_pbes_expression_new(const std::string &text)
The main namespace for the PBES library.
atermpp::aterm_istream & operator>>(atermpp::aterm_istream &stream, pbes &pbes)
Reads a pbes from a stream.
static atermpp::aterm remove_index_impl(const atermpp::aterm &x)
void load_pbes(pbes &pbes, std::istream &stream, utilities::file_format format, const std::string &)
Load a PBES from file.
void save_pbes(const pbes &pbes, const std::string &filename, utilities::file_format format, bool welltypedness_check)
save_pbes Saves a PBES to a file.
const utilities::file_format & pbes_format_internal_bes()
atermpp::aterm pbes_marker()
void load_pbes(pbes &pbes, const std::string &filename, utilities::file_format format)
Load pbes from file.
const utilities::file_format & pbes_format_pgsolver()
pbes parse_pbes(const std::string &text)
std::istream & operator>>(std::istream &from, pbes &result)
Reads a PBES from an input stream.
atermpp::aterm pbes_to_aterm(const pbes &p)
Conversion to atermappl.
pbes parse_pbes(std::istream &in)
propositional_variable parse_propositional_variable(const std::string &text, const VariableContainer &variables, const data::data_specification &dataspec=data::data_specification())
const std::vector< utilities::file_format > & pbes_file_formats()
pbes_system::pbes_expression translate_user_notation(const pbes_system::pbes_expression &x)
void save_pbes(const pbes &pbes, std::ostream &stream, utilities::file_format format)
Save a PBES in the format specified.
void complete_data_specification(pbes &)
Adds all sorts that appear in the PBES p to the data specification of p.
atermpp::aterm_istream & operator>>(atermpp::aterm_istream &stream, pbes_equation &equation)
const utilities::file_format & pbes_format_internal()
const utilities::file_format & pbes_format_text()
pbes_expression parse_pbes_expression(const std::string &text, const pbes &pbesspec, const VariableContainer &variables, bool type_check=true, bool translate_user_notation=true, bool normalize_sorts=true)
Parse a pbes expression. Throws an exception if something went wrong.
pbes_expression parse_pbes_expression(const std::string &text, const data::data_specification &dataspec, const VariableContainer &variables, const PropositionalVariableContainer &propositional_variables, bool type_check=true, bool translate_user_notation=true, bool normalize_sorts=true)
Parse a pbes expression. Throws an exception if something went wrong.
static atermpp::aterm add_index_impl(const atermpp::aterm &x)