mCRL2
Loading...
Searching...
No Matches
jitty.h
Go to the documentation of this file.
1// Author(s): Muck van Weerdenburg
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//
9
10#ifndef MCRL2_DATA_DETAIL_REWRITE_JITTY_H
11#define MCRL2_DATA_DETAIL_REWRITE_JITTY_H
12
16
17namespace mcrl2
18{
19namespace data
20{
21namespace detail
22{
23
25{
26 const variable& var;
29
31 : var(m_var),
32 term(m_term),
34 {}
35};
36
38{
39 std::size_t size;
41
43 : size(0),
44 assignment(a)
45 {}
46
47};
48
50{
51 public:
53
55
57
58 // The copy constructor.
59 RewriterJitty(const RewriterJitty& other) = default;
60
61 // The assignment operator.
62 RewriterJitty& operator=(const RewriterJitty& other) = delete;
63
64 virtual ~RewriterJitty();
65
67
69
71
72 std::shared_ptr<detail::Rewriter> clone()
73 {
74 return std::shared_ptr<Rewriter>(new RewriterJitty(*this));
75 }
76
78 {
80 }
81
82 protected:
83
84 // A dedicated function symbol that indicates that a term is in normal form. It has name "Rewritten@@term".
85 // The function symbol below is used to administrate that a term is in normal form. It is put around a term.
86 // Terms with this auxiliary function symbol cannot be printed using the pretty printer for data expressions.
89
90 class rewrite_stack m_rewrite_stack; // Stack for intermediate rewrite results.
91
92 std::vector<data_expression> rhs_for_constants_cache; // Cache that contains normal forms for constants.
93 std::map< function_symbol, data_equation_list > jitty_eqns;
94 std::vector<strategy> jitty_strat;
95
96 atermpp::detail::thread_aterm_pool* m_thread_aterm_pool; // Store an explicit reference to the thread aterm pool.
97
98
99 template <class ITERATOR>
101 data_expression& result,
102 const application& t,
103 const std::function<void(data_expression&, const data_expression&)> rewrite_cpp_code,
104 ITERATOR begin,
105 ITERATOR end,
107
108
110
112 data_expression& result,
113 const function_symbol& op,
114 const application& term,
116
118 data_expression& result,
119 const function_symbol& op,
121
124 void make_jitty_strat_sufficiently_larger(const std::size_t i);
125
128 strategy create_strategy(const function_symbol& f, const data_equation_list& rules1, const data_specification& data_spec);
129 void rebuild_strategy(const data_specification& data_spec, const mcrl2::data::used_data_equation_selector& equation_selector);
130
132 void subst_values(
133 data_expression& result,
134 const jitty_assignments_for_a_rewrite_rule& assignments,
135 const data_expression& t,
137
139 {
141 }
142};
143
149
150} // namespace detail
151} // namespace data
152} // namespace mcrl2
153
154#endif
This is a thread's specific access to the global aterm pool which ensures that garbage collection and...
A list of aterm objects.
Definition aterm_list.h:24
An application of a data expression to a number of arguments.
\brief Assignment of a data expression to a variable
Definition assignment.h:91
std::shared_ptr< detail::Rewriter > clone()
Clone a rewriter.
Definition jitty.h:72
strategy create_a_rewriting_based_strategy(const function_symbol &f, const data_equation_list &rules1)
Definition strategy.cpp:46
rewrite_strategy getStrategy()
Get rewriter strategy that is used.
Definition jitty.cpp:917
strategy create_a_cpp_function_based_strategy(const function_symbol &f, const data_specification &data_spec)
Definition strategy.cpp:222
class rewrite_stack m_rewrite_stack
Definition jitty.h:90
void rewrite_aux_const_function_symbol(data_expression &result, const function_symbol &op, substitution_type &sigma)
Definition jitty.cpp:794
data_expression rewrite(const data_expression &term, substitution_type &sigma)
Rewrite an mCRL2 data term.
Definition jitty.cpp:907
void rewrite_aux(data_expression &result, const data_expression &term, substitution_type &sigma)
Rewrite a term with a given substitution and put the rewritten term in result.
Definition jitty.cpp:433
RewriterJitty(const RewriterJitty &other)=default
strategy create_strategy(const function_symbol &f, const data_equation_list &rules1, const data_specification &data_spec)
Definition strategy.cpp:242
void apply_cpp_code_to_higher_order_term(data_expression &result, const application &t, const std::function< void(data_expression &, const data_expression &)> rewrite_cpp_code, ITERATOR begin, ITERATOR end, substitution_type &sigma)
Definition jitty.cpp:404
const function_symbol & this_term_is_in_normal_form()
Definition jitty.h:77
void subst_values(data_expression &result, const jitty_assignments_for_a_rewrite_rule &assignments, const data_expression &t, data::enumerator_identifier_generator &generator)
Definition jitty.cpp:210
RewriterJitty & operator=(const RewriterJitty &other)=delete
void rewrite_aux_function_symbol(data_expression &result, const function_symbol &op, const application &term, substitution_type &sigma)
Definition jitty.cpp:569
data_expression remove_normal_form_function(const data_expression &t)
Definition jitty.cpp:38
atermpp::detail::thread_aterm_pool * m_thread_aterm_pool
Definition jitty.h:96
void rebuild_strategy(const data_specification &data_spec, const mcrl2::data::used_data_equation_selector &equation_selector)
Definition jitty.cpp:144
std::vector< strategy > jitty_strat
Definition jitty.h:94
std::map< function_symbol, data_equation_list > jitty_eqns
Definition jitty.h:93
Rewriter::substitution_type substitution_type
Definition jitty.h:54
function_symbol this_term_is_in_normal_form_symbol
Definition jitty.h:87
void make_jitty_strat_sufficiently_larger(const std::size_t i)
Auxiliary function to take care that the array jitty_strat is sufficiently large to access element i.
Definition jitty.cpp:136
std::vector< data_expression > rhs_for_constants_cache
Definition jitty.h:92
Rewriter interface class.
Definition rewrite.h:42
A strategy is a list of rules and the number of variables that occur in it.
\brief A function symbol
Component for selecting a subset of equations that are actually used in an encompassing specification...
Definition selection.h:37
\brief A data variable
Definition variable.h:28
static RewriterCompilingJitty::substitution_type & sigma(RewriterCompilingJitty *this_rewriter)
thread_aterm_pool & g_thread_term_pool()
A reference to the thread local term pool storage.
data_expression remove_normal_form_function(const data_expression &t)
removes auxiliary expressions this_term_is_in_normal_form from data_expressions that are being rewrit...
rewrite_strategy
The strategy of the rewriter.
A class that takes a linear process specification and checks all tau-summands of that LPS for conflue...
Definition indexed_set.h:72
This file contains a rewrite stack that can operate alongside the normal stack. As it is an atermpp c...
jitty_variable_assignment_for_a_rewrite_rule * assignment
Definition jitty.h:40
jitty_assignments_for_a_rewrite_rule(jitty_variable_assignment_for_a_rewrite_rule *a)
Definition jitty.h:42
jitty_variable_assignment_for_a_rewrite_rule(const variable &m_var, const data_expression &m_term, bool m_nf)
Definition jitty.h:30