mCRL2
Loading...
Searching...
No Matches
rewriter_tool.h
Go to the documentation of this file.
1// Author(s): Wieger Wesselink
2// Copyright: see the accompanying file COPYING or copy at
3// https://github.com/mCRL2org/mCRL2/blob/master/COPYING
4//
5// Distributed under the Boost Software License, Version 1.0.
6// (See accompanying file LICENSE_1_0.txt or copy at
7// http://www.boost.org/LICENSE_1_0.txt)
8//
11
12#ifndef MCRL2_DATA_REWRITER_TOOL_H
13#define MCRL2_DATA_REWRITER_TOOL_H
14
16#include "mcrl2/data/rewriter.h"
18
19namespace mcrl2
20{
21
22namespace data
23{
24
25namespace tools
26{
27
29template <typename Tool>
30class rewriter_tool: public Tool
31{
32 protected:
35
40 void add_options(utilities::interface_description& desc, bool suppress_jittyp)
41 {
42 Tool::add_options(desc);
43
44 utilities::interface_description::enum_argument<data::rewrite_strategy> rewriter_option("NAME");
45 rewriter_option.add_value(data::jitty, true);
46#ifdef MCRL2_ENABLE_JITTYC
47 rewriter_option.add_value(data::jitty_compiling);
48#endif
49 if (!suppress_jittyp)
50 {
51 rewriter_option.add_value(data::jitty_prover);
52 }
53
54 desc.add_option(
55 "rewriter",
56 rewriter_option,
57 "use rewrite strategy NAME:"
58 ,'r'
59 );
60
61 desc.add_option(
62 "qlimit",
64 "limit enumeration of universal and existential quantifiers in data expressions to NUM iterations (default NUM=10, NUM=0 for unlimited).",
65 'Q'
66 );
67
68 }
69
73 void add_options(utilities::interface_description& desc)
74 {
75 add_options(desc,false);
76 }
77
78
81 void parse_options(const utilities::command_line_parser& parser)
82 {
83 Tool::parse_options(parser);
84 m_rewrite_strategy = parser.option_argument_as< data::rewrite_strategy >("rewriter");
85
86 if (parser.options.count("qlimit"))
87 {
88 //Set enumerator limit for quantifier enumeration
89 std::size_t qlimit = parser.option_argument_as< std::size_t >("qlimit");
90 data::detail::set_enumerator_iteration_limit(qlimit == 0 ? std::numeric_limits<std::size_t>::max() : qlimit);
91 }
92 else
93 {
95 }
96 }
97
98 public:
99
101 rewriter_tool(const std::string& name,
102 const std::string& author,
103 const std::string& what_is,
104 const std::string& tool_description,
105 std::string known_issues = ""
106 )
107 : Tool(name, author, what_is, tool_description, known_issues),
109 {}
110
114 {
115 return m_rewrite_strategy;
116 }
117
122 {
123 return data::rewriter(data_spec, rewrite_strategy());
124 }
125};
126
127} // namespace tools
128
129} // namespace data
130
131} // namespace mcrl2
132
133#endif // MCRL2_DATA_REWRITER_TOOL_H
Rewriter that operates on data expressions.
Definition rewriter.h:81
Base class for tools that use a rewriter.
void add_options(utilities::interface_description &desc)
Add options to an interface description. Also includes rewriter options.
data::rewrite_strategy m_rewrite_strategy
The data rewriter strategy.
void parse_options(const utilities::command_line_parser &parser)
Parse non-standard options.
void add_options(utilities::interface_description &desc, bool suppress_jittyp)
Add options to an interface description. Also includes rewriter options.
rewriter_tool(const std::string &name, const std::string &author, const std::string &what_is, const std::string &tool_description, std::string known_issues="")
Constructor.
data::rewrite_strategy rewrite_strategy() const
Returns the rewrite strategy.
data::rewriter create_rewriter(const data::data_specification &data_spec=data::data_specification())
Creates a data rewriter as specified on the command line.
Components for command line interfaces of mCRL2 tools.
The class rewriter.
Stores a static variable that indicates the number of iterations allowed during enumeration.
void set_enumerator_iteration_limit(std::size_t size)
rewrite_strategy
The strategy of the rewriter.
@ jitty_prover
JITty.
interface_description::mandatory_argument< std::string > make_mandatory_argument(std::string const &name, std::string const &default_value)
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72