12#ifndef MCRL2_PROCESS_PRINT_H
13#define MCRL2_PROCESS_PRINT_H
46 return core::detail::max_precedence;
88template <
typename Derived>
97 using super::print_assignments;
98 using super::print_list;
99 using super::print_variables;
100 using super::print_expression;
101 using super::print_unary_operand;
102 using super::print_binary_operation;
106 derived().print(
"init ");
107 derived().apply(
init);
108 derived().print(
";\n");
113 print_expression(condition,
false);
114 derived().print(arrow);
118 template <
typename Container>
120 const std::string& opener =
"(",
121 const std::string& closer =
")",
122 const std::string& separator =
", "
126 if (container.empty())
131 auto first = container.
begin();
132 auto last = container.
end();
134 derived().print(opener);
136 while (first != last)
138 if (first != container.
begin())
140 derived().print(separator);
143 typename Container::const_iterator i = first;
148 while (i != last && first->sorts() == i->sorts());
150 print_list(std::vector<process::action_label>(first, i),
"",
"",
",");
151 if (!first->sorts().
empty())
153 derived().print(
": ");
154 print_list(first->sorts(),
"",
"",
" # ");
159 derived().print(closer);
163 template <
typename Container>
165 const std::string& opener =
"(",
166 const std::string& closer =
")",
167 const std::string& separator =
", "
170 typedef typename Container::value_type T;
173 if (container.empty())
179 std::map<data::sort_expression_list, std::vector<T> > sort_map;
183 std::vector<data::sort_expression_list> sort_lists;
185 for (
auto i = container.begin(); i != container.end(); ++i)
187 if (sort_map.find(i->sorts()) == sort_map.end())
189 sort_lists.push_back(i->sorts());
191 sort_map[i->sorts()].push_back(*i);
195 derived().print(opener);
196 for (
auto i = sort_lists.begin(); i != sort_lists.end(); ++i)
198 if (i != sort_lists.begin())
200 derived().print(separator);
202 const std::vector<T>& v = sort_map[*i];
203 print_list(v,
"",
"",
",");
206 derived().print(
": ");
207 print_list(*i,
"",
"",
" # ");
210 derived().print(closer);
216 derived().apply(x.
name());
223 derived().apply(x.
label());
224 print_list(x.
arguments(),
"(",
")",
", ");
231 derived().apply(x.
data());
233 print_variables(x.
global_variables(),
true,
true,
true,
"glob ",
";\n\n",
";\n ");
234 print_list(x.
equations(),
"proc ",
"\n\n",
"\n ");
242 derived().apply(x.
name());
251 derived().print(
" = ");
253 derived().print(
";");
269 derived().print(
"(");
271 derived().print(
")");
278 derived().print(
"delta");
285 derived().print(
"tau");
292 derived().print(
"sum ");
293 print_variables(x.
variables(),
true,
true,
false,
"",
"");
294 derived().print(
". ");
295 print_unary_operand(x, x.
operand());
302 derived().print(
"dist ");
303 print_variables(x.
variables(),
true,
true,
false,
"",
"");
304 derived().print(
"[");
306 derived().print(
"] . ");
307 print_unary_operand(x, x.
operand());
314 derived().print(
"block(");
315 print_list(x.
block_set(),
"{",
"}, ",
", ",
true);
317 derived().print(
")");
324 derived().print(
"hide(");
325 print_list(x.
hide_set(),
"{",
"}, ",
", ");
327 derived().print(
")");
334 derived().apply(x.
source());
335 derived().print(
" -> ");
336 derived().apply(x.
target());
343 derived().print(
"rename(");
346 derived().print(
")");
353 print_list(x.
names(),
"",
"",
" | ");
361 derived().print(
" -> ");
362 derived().apply(x.
name());
369 derived().print(
"comm(");
370 print_list(x.
comm_set(),
"{",
"}, ",
", ");
372 derived().print(
")");
379 derived().print(
"allow(");
380 print_list(x.
allow_set(),
"{",
"}, ",
", ",
true);
382 derived().print(
")");
389 print_binary_operation(x,
" | ");
397 derived().print(
" @ ");
405 print_binary_operation(x,
" . ");
424 derived().print(
" <> ");
432 print_binary_operation(x,
" << ");
439 print_binary_operation(x,
" || ");
446 print_binary_operation(x,
" ||_ ");
453 print_binary_operation(x,
" + ");
460 derived().apply(x.
name());
461 print_assignments(x.
assignments(),
true,
"(",
")",
", ");
468 print_list(x.
actions(),
"",
"",
" | ");
479 template <
typename T>
482 core::detail::apply_printer<process::detail::printer> printer(out);
489std::string
pp(
const T& x)
491 std::ostringstream out;
bool empty() const
Returns true if the term has no arguments.
const_iterator end() const
const_iterator begin() const
const core::identifier_string & name() const
\brief A multiset of action names
const core::identifier_string_list & names() const
const data::data_expression_list & arguments() const
const action_label & label() const
\brief The allow operator
const process_expression & operand() const
const action_name_multiset_list & allow_set() const
const data::data_expression & time_stamp() const
const process_expression & operand() const
\brief The block operator
const process_expression & operand() const
const core::identifier_string_list & block_set() const
\brief The bounded initialization
\brief The choice operator
\brief The communication operator
const communication_expression_list & comm_set() const
const process_expression & operand() const
\brief A communication expression
const core::identifier_string & name() const
const action_name_multiset & action_name() const
const core::identifier_string_list & hide_set() const
const process_expression & operand() const
\brief The if-then-else operator
const process_expression & else_case() const
const process_expression & then_case() const
const data::data_expression & condition() const
\brief The if-then operator
const process_expression & then_case() const
const data::data_expression & condition() const
\brief The left merge operator
\brief The merge operator
\brief A process equation
const data::variable_list & formal_parameters() const
const process_identifier & identifier() const
const process_expression & expression() const
\brief A process expression
\brief A process identifier
const core::identifier_string & name() const
\brief A process assignment
const data::assignment_list & assignments() const
const process_identifier & identifier() const
const data::data_expression_list & actual_parameters() const
const process_identifier & identifier() const
Process specification consisting of a data specification, action labels, a sequence of process equati...
const std::vector< process_equation > & equations() const
Returns the equations of the process specification.
const process_expression & init() const
Returns the initialization of the process specification.
const data::data_specification & data() const
Returns the data specification.
const process::action_label_list & action_labels() const
Returns the action label specification.
const std::set< data::variable > & global_variables() const
Returns the declared free variables of the process specification.
\brief A rename expression
const core::identifier_string & source() const
const core::identifier_string & target() const
\brief The rename operator
const process_expression & operand() const
const rename_expression_list & rename_set() const
\brief The sequential composition
\brief The distribution operator
const data::variable_list & variables() const
const data::data_expression & distribution() const
const process_expression & operand() const
const process_expression & operand() const
const data::variable_list & variables() const
\brief The synchronization operator
\brief An untyped multi action or data application
const data::untyped_data_parameter_list & actions() const
\brief An untyped process assginment
const data::untyped_identifier_assignment_list & assignments() const
const core::identifier_string & name() const
Provides utilities for pretty printing.
MCRL2_EXPORT bool init(rewriter_interface *i, RewriterCompilingJitty *this_rewriter)
bool is_at(const atermpp::aterm &x)
bool is_left_associative(const choice &)
bool is_seq(const atermpp::aterm &x)
bool is_merge(const atermpp::aterm &x)
bool is_bounded_init(const atermpp::aterm &x)
bool is_sum(const atermpp::aterm &x)
constexpr int precedence(const choice &)
bool is_if_then_else(const atermpp::aterm &x)
bool is_right_associative(const choice &)
bool is_left_merge(const atermpp::aterm &x)
std::string pp(const action_label &x)
bool is_if_then(const atermpp::aterm &x)
bool is_choice(const atermpp::aterm &x)
bool is_stochastic_operator(const atermpp::aterm &x)
bool is_sync(const atermpp::aterm &x)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
add your file description here.
void apply(const process::action_label &x)
void apply(const process::stochastic_operator &x)
void apply(const process::delta &x)
void apply(const process::process_instance_assignment &x)
void apply(const process::process_identifier &x)
void apply(const process::process_equation &x)
void print_if_then_condition(const data::data_expression &condition, const std::string &arrow=" -> ")
void apply(const process::tau &x)
void apply(const process::if_then &x)
void apply(const process::choice &x)
void apply(const process::sum &x)
void apply(const process::allow &x)
void apply(const process::merge &x)
void apply(const process::at &x)
void apply(const process::if_then_else &x)
void apply(const process::bounded_init &x)
void apply(const process::sync &x)
void apply(const process::rename &x)
void apply(const process::block &x)
void apply(const process::action_name_multiset &x)
void apply(const process::seq &x)
void apply(const process::rename_expression &x)
void apply(const process::hide &x)
void print_initial_state(const process_expression &init)
void print_action_declarations(const Container &container, const std::string &opener="(", const std::string &closer=")", const std::string &separator=", ")
void print_action_declarations_maximally_shared(const Container &container, const std::string &opener="(", const std::string &closer=")", const std::string &separator=", ")
void apply(const process::action &x)
void apply(const process::process_specification &x)
void apply(const process::untyped_multi_action &x)
process::add_traverser_sort_expressions< data::detail::printer, Derived > super
void apply(const process::comm &x)
void apply(const process::left_merge &x)
void apply(const process::action_label &x)
void apply(const process::process_instance &x)
void apply(const process::communication_expression &x)
void apply(const process::untyped_process_assignment &x)
Prints the object x to a stream.
void operator()(const T &x, std::ostream &out)