1 #ifndef STAN_LANG_GRAMMARS_SEMANTIC_ACTIONS_HPP
2 #define STAN_LANG_GRAMMARS_SEMANTIC_ACTIONS_HPP
6 #include <boost/variant/recursive_variant.hpp>
7 #include <boost/spirit/include/qi.hpp>
21 const std::string& new_suffix, fun& f);
24 std::stringstream& error_msgs);
28 int num_dimss(std::vector<std::vector<stan::lang::expression> >& dimss);
45 template <
typename F,
typename T1>
64 template <
typename F,
typename T1,
typename T2>
83 template <
typename F,
typename T1,
typename T2,
typename T3>
102 template <
typename F,
typename T1,
typename T2,
typename T3,
typename T4>
121 template <
typename F,
typename T1,
typename T2,
typename T3,
122 typename T4,
typename T5>
141 template <
typename F,
typename T1,
typename T2,
typename T3,
142 typename T4,
typename T5,
typename T6>
143 struct result<F(T1, T2, T3, T4, T5, T6)> {
typedef void type; };
161 template <
typename F,
typename T1,
typename T2,
typename T3,
162 typename T4,
typename T5,
typename T6,
typename T7>
163 struct result<F(T1, T2, T3, T4, T5, T6, T7)> {
typedef void type; };
168 template <
typename L,
typename R>
171 extern boost::phoenix::function<assign_lhs>
assign_lhs_f;
177 std::ostream& error_msgs)
const;
191 std::ostream& error_msgs)
const;
193 extern boost::phoenix::function<addition_expr3>
addition3_f;
198 std::ostream& error_msgs)
const;
200 extern boost::phoenix::function<subtraction_expr3>
subtraction3_f;
213 std::ostream& error_msgs)
const;
215 extern boost::phoenix::function<validate_conditional_op>
222 const std::string& op,
const std::string& fun_name,
223 std::ostream& error_msgs)
const;
225 extern boost::phoenix::function<binary_op_expr>
binary_op_f;
231 std::ostream& error_msgs)
const;
233 extern boost::phoenix::function<validate_non_void_arg_function>
239 bool& pass, std::ostream& error_msgs)
const;
245 void operator()(
const std::string& identifier,
bool& allow_sampling,
248 extern boost::phoenix::function<set_allows_sampling_origin>
254 std::set<std::pair<std::string,
256 std::set<std::pair<std::string,
258 std::ostream& error_msgs)
const;
260 extern boost::phoenix::function<validate_declarations>
267 std::set<std::pair<std::string,
269 std::set<std::pair<std::string,
271 std::ostream& error_msgs)
const;
273 extern boost::phoenix::function<add_function_signature>
279 std::ostream& error_msgs)
const;
281 extern boost::phoenix::function<validate_return_type>
287 std::ostream& error_msgs)
const;
289 extern boost::phoenix::function<validate_pmf_pdf_variate>
294 void operator()(std::string& fname,
bool& pass,
295 std::ostream& error_msgs)
const;
304 extern boost::phoenix::function<scope_lp>
scope_lp_f;
316 std::ostream& error_msgs)
const;
330 extern boost::phoenix::function<validate_int_expression>
336 std::ostream& error_msgs)
const;
338 extern boost::phoenix::function<validate_ints_expression>
345 extern boost::phoenix::function<add_lp_var>
add_lp_var_f;
357 std::stringstream& error_msgs)
const;
364 bool& pass, std::stringstream& error_msgs)
const;
366 extern boost::phoenix::function<add_conditional_condition>
373 extern boost::phoenix::function<add_conditional_body>
378 void operator()(std::ostream& error_msgs)
const;
380 extern boost::phoenix::function<deprecate_old_assignment_op>
388 extern boost::phoenix::function<validate_return_allowed>
396 extern boost::phoenix::function<validate_void_return_allowed>
403 std::ostream& error_msgs)
const;
425 bool& pass, std::ostream& error_msgs)
const;
432 std::stringstream& error_msgs)
const;
434 extern boost::phoenix::function<expression_as_statement>
447 bool& pass, std::stringstream& error_msgs)
const;
459 void operator()(
const std::string& name, std::string& name_local,
461 std::stringstream& error_msgs)
const;
469 extern boost::phoenix::function<remove_loop_identifier>
475 std::stringstream& error_msgs)
const;
477 extern boost::phoenix::function<validate_int_expr_warn>
482 void operator()(std::stringstream& error_msgs)
const;
484 extern boost::phoenix::function<deprecate_increment_log_prob>
489 void operator()(
const bool& allow_sample,
bool& pass,
490 std::stringstream& error_msgs)
const;
492 extern boost::phoenix::function<validate_allow_sample>
500 extern boost::phoenix::function<validate_non_void_expression>
521 extern boost::phoenix::function<set_no_op>
set_no_op_f;
527 void operator()(std::ostream& error_msgs)
const;
529 extern boost::phoenix::function<deprecated_integrate_ode>
538 std::ostream& error_msgs);
544 std::ostream& error_msgs)
const;
546 extern boost::phoenix::function<validate_integrate_ode>
554 std::ostream& error_msgs)
const;
556 extern boost::phoenix::function<validate_integrate_ode_control>
563 std::ostream& error_msgs)
const;
571 std::ostream& error_msgs)
const;
578 std::ostream& error_msgs)
const;
585 std::ostream& error_msgs)
const;
587 extern boost::phoenix::function<division_expr>
division_f;
592 bool& pass, std::ostream& error_msgs)
const;
594 extern boost::phoenix::function<modulus_expr>
modulus_f;
599 std::ostream& error_msgs)
const;
606 std::ostream& error_msgs)
const;
608 extern boost::phoenix::function<elt_multiplication_expr>
614 std::ostream& error_msgs)
const;
616 extern boost::phoenix::function<elt_division_expr>
elt_division_f;
621 bool& pass, std::ostream& error_msgs)
const;
628 std::ostream& error_msgs)
const;
635 std::ostream& error_msgs)
const;
637 extern boost::phoenix::function<transpose_expr>
transpose_f;
642 std::ostream& error_msgs)
const;
644 extern boost::phoenix::function<add_idxs>
add_idxs_f;
649 std::vector<std::vector<stan::lang::expression> >& dimss,
650 bool& pass, std::ostream& error_msgs)
const;
652 extern boost::phoenix::function<add_expression_dimss>
658 std::ostream& error_msgs,
bool& pass)
const;
703 void operator()(
const bool& allow_constraints,
705 bool& pass, std::stringstream& error_msgs)
const;
707 extern boost::phoenix::function<validate_decl_constraints>
715 void operator()(
const std::string& identifier,
bool& pass,
716 std::stringstream& error_msgs)
const;
717 bool contains(
const std::set<std::string>& s,
718 const std::string& x)
const;
720 void reserve(
const std::string& w);
729 extern boost::phoenix::function<copy_square_cholesky_dimension_if_necessary>
739 std::stringstream& error_msgs)
const;
745 std::stringstream& error_msgs)
const;
751 std::stringstream& error_msgs)
const;
760 extern boost::phoenix::function<validate_int_data_expr>
765 std::stringstream& error_msgs)
const;
767 extern boost::phoenix::function<set_double_range_lower>
772 std::stringstream& error_msgs)
const;
774 extern boost::phoenix::function<set_double_range_upper>
778 template <
typename T>
781 std::ostream& error_msgs)
784 extern boost::phoenix::function<add_var>
add_var_f;
boost::phoenix::function< validate_return_allowed > validate_return_allowed_f
void operator()(const std::string &identifier, bool &allow_sampling, int &origin) const
void operator()(expression &expr_result, const expression &expr, bool &pass, std::ostream &error_msgs) const
bool operator()(const nil &) const
boost::phoenix::function< set_void_function > set_void_function_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
boost::phoenix::function< add_while_body > add_while_body_f
void operator()(const std::string &identifier, bool &pass, std::stringstream &error_msgs) const
void operator()(const expr_type &arg_type, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< set_int_range_upper > set_int_range_upper_f
void operator()(const bool &allow_sample, bool &pass, std::stringstream &error_msgs) const
void operator()(const integrate_ode &ode_fun, const variable_map &var_map, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< validate_assgn > validate_assgn_f
boost::phoenix::function< set_var_type > set_var_type_f
void set_fun_type(fun &fun, std::ostream &error_msgs)
void operator()(expression &e, std::vector< idx > &idxs, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< set_int_range_lower > set_int_range_lower_f
void operator()(const expression &expr, bool &pass, std::stringstream &error_msgs) const
boost::phoenix::function< binary_op_expr > binary_op_f
boost::phoenix::function< validate_expr_type3 > validate_expr_type3_f
void operator()(std::stringstream &error_msgs) const
boost::phoenix::function< deprecated_integrate_ode > deprecated_integrate_ode_f
int num_dimss(std::vector< std::vector< stan::lang::expression > > &dimss)
void operator()(const expression &e, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< set_fun_type_named > set_fun_type_named_f
std::set< std::string > const_fun_name_set_
Declare result to be a template struct.
boost::phoenix::function< set_no_op > set_no_op_f
void operator()(const expression &e, bool &pass) const
boost::phoenix::function< validate_conditional_op > validate_conditional_op_f
void operator()(function_decl_def &decl, bool &pass, std::ostream &error_msgs) const
Probability, optimization and sampling library.
void operator()(range &range, const expression &expr, bool &pass, std::stringstream &error_msgs) const
Declare result to be a template struct.
boost::phoenix::function< deprecate_increment_log_prob > deprecate_increment_log_prob_f
void operator()(expression &expr1, const expression &expr2, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< program_error > program_error_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
validate_no_constraints_vis(std::stringstream &error_msgs)
void operator()(var_decl &var_decl_result, const T &var_decl, variable_map &vm, bool &pass, const var_origin &vo, std::ostream &error_msgs) const
void operator()(const std::vector< var_decl > &var_decls, variable_map &vm) const
void operator()(const expression &e, bool &pass, std::ostream &error_msgs) const
bool validate_double_expr(const expression &expr, std::stringstream &error_msgs)
boost::phoenix::function< validate_int_expression > validate_int_expression_f
bool has_prob_suffix(const std::string &s)
void operator()(std::ostream &error_msgs) const
void operator()(range &range, const expression &expr, bool &pass, std::stringstream &error_msgs) const
void operator()(while_statement &ws, const expression &e, bool &pass, std::stringstream &error_msgs) const
boost::spirit::line_pos_iterator< input_iterator_t > pos_iterator_t
void operator()(expression &expr_result, const expression &expr, std::ostream &error_msgs) const
void operator()(cholesky_factor_var_decl &var_decl) const
void operator()(expression &expr1, bool &pass, const expression &expr2, std::ostream &error_msgs) const
boost::phoenix::function< validate_ints_expression > validate_ints_expression_f
boost::phoenix::function< add_conditional_condition > add_conditional_condition_f
boost::phoenix::function< empty_range > empty_range_f
boost::phoenix::function< subtraction_expr3 > subtraction3_f
boost::phoenix::function< addition_expr3 > addition3_f
This is the base class for septenary functors that are adapted to lazy semantic actions by boost::pho...
void operator()(const expression &expr, int var_origin, bool &pass, variable_map &var_map, std::stringstream &error_msgs) const
void operator()(std::string &fname, bool &pass, std::ostream &error_msgs) const
This is the base class for quatenary functors that are adapted to lazy semantic actions by boost::pho...
void validate_integrate_ode_non_control_args(const T &ode_fun, const variable_map &var_map, bool &pass, std::ostream &error_msgs)
void replace_suffix(const std::string &old_suffix, const std::string &new_suffix, fun &f)
Declare result to be a template struct.
boost::phoenix::function< add_var > add_var_f
boost::phoenix::function< remove_lp_var > remove_lp_var_f
void operator()(const integrate_ode_control &ode_fun, const variable_map &var_map, bool &pass, std::ostream &error_msgs) const
void operator()(arg_decl &decl, bool &pass, variable_map &vm, std::ostream &error_msgs) const
boost::phoenix::function< exponentiation_expr > exponentiation_f
boost::phoenix::function< add_loop_identifier > add_loop_identifier_f
Declare result to be a template struct.
boost::phoenix::function< set_double_range_lower > set_double_range_lower_f
boost::phoenix::function< validate_void_return_allowed > validate_void_return_allowed_f
void operator()(omni_idx &val) const
void operator()(expression &expr1, const expression &expr2, const std::string &op, const std::string &fun_name, std::ostream &error_msgs) const
void operator()(conditional_op &cond_expr, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< validate_non_void_arg_function > validate_non_void_arg_f
bool contains(const std::set< std::string > &s, const std::string &x) const
void operator()(statement &stmt, const pos_iterator_t &begin, const pos_iterator_t &end) const
void reserve(const std::string &w)
boost::phoenix::function< remove_loop_identifier > remove_loop_identifier_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
void operator()(range &range, const expression &expr, bool &pass, std::stringstream &error_msgs) const
boost::phoenix::function< add_conditional_body > add_conditional_body_f
boost::phoenix::function< transpose_expr > transpose_f
boost::phoenix::function< multiplication_expr > multiplication_f
void operator()(const std::string &s, bool &pass) const
void operator()(const bool &allow_constraints, const bool &declaration_ok, const var_decl &var_decl, bool &pass, std::stringstream &error_msgs) const
boost::phoenix::function< validate_identifier > validate_identifier_f
void operator()(expression &expression, std::vector< std::vector< stan::lang::expression > > &dimss, bool &pass, std::ostream &error_msgs) const
This is the base class for binary functors that are adapted to lazy semantic actions by boost::phoeni...
boost::phoenix::function< validate_int_expr > validate_int_expr_f
void operator()(range &range, const expression &expr, bool &pass, std::stringstream &error_msgs) const
void operator()(expression &fun_result, fun &fun, const var_origin &var_origin, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< validate_decl_constraints > validate_decl_constraints_f
boost::phoenix::function< add_expression_dimss > add_expression_dimss_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
This is the base class for quinary functors that are adapted to lazy semantic actions by boost::phoen...
boost::phoenix::function< validate_prob_fun > validate_prob_fun_f
boost::phoenix::function< add_line_number > add_line_number_f
boost::phoenix::function< validate_int_data_expr > validate_int_data_expr_f
void operator()(const assgn &a, bool &pass, std::ostream &error_msgs) const
void operator()(variable &var_expr, expression &val, variable_map &vm, std::ostream &error_msgs, bool &pass) const
std::stringstream & error_msgs_
void operator()(const expression &expr, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< is_prob_fun > is_prob_fun_f
void operator()(conditional_statement &cs, const expression &e, bool &pass, std::stringstream &error_msgs) const
boost::phoenix::function< set_omni_idx > set_omni_idx_f
bool operator()(const nil &) const
void operator()(var_origin origin, bool &pass, std::ostream &error_msgs) const
void operator()(const std::string &name, std::string &name_local, bool &pass, variable_map &vm, std::stringstream &error_msgs) const
std::pair< expr_type, std::vector< expr_type > > function_signature_t
boost::phoenix::function< validate_allow_sample > validate_allow_sample_f
boost::phoenix::function< assign_lhs > assign_lhs_f
This is the base class for senary functors that are adapted to lazy semantic actions by boost::phoeni...
std::set< std::string > reserved_word_set_
void operator()(size_t &lhs) const
void operator()(std::ostream &error_msgs) const
boost::phoenix::function< validate_integrate_ode > validate_integrate_ode_f
This is the base class for unnary functors that are adapted to lazy semantic actions by boost::phoeni...
boost::phoenix::function< expression_as_statement > expression_as_statement_f
boost::phoenix::function< validate_pmf_pdf_variate > validate_pmf_pdf_variate_f
boost::phoenix::function< add_lp_var > add_lp_var_f
void operator()(const std::string &name, variable_map &vm) const
boost::phoenix::function< elt_multiplication_expr > elt_multiplication_f
void operator()(const expr_type &return_type, var_origin &origin, bool &pass, std::ostream &error_msgs) const
void operator()(variable_map &vm) const
void operator()(function_decl_def &decl, variable_map &vm) const
void operator()(expression &expr1, const expression &expr2, const var_origin &var_origin, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< set_allows_sampling_origin > set_allows_sampling_origin_f
void operator()(expression &expr, bool &pass, std::ostream &error_msgs) const
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
boost::phoenix::function< validate_int_expr_warn > validate_int_expr_warn_f
boost::phoenix::function< logical_negate_expr > logical_negate_expr_f
bool identifier_exists(const std::string &identifier) const
This is the base class for ternary functors that are adapted to lazy semantic actions by boost::phoen...
boost::phoenix::function< validate_sample > validate_sample_f
boost::phoenix::function< increment_size_t > increment_size_t_f
boost::phoenix::function< add_function_signature > add_function_signature_f
void operator()(const expression &expr, bool &pass, std::stringstream &error_msgs) const
void operator()(const function_decl_def &decl, bool &pass, std::set< std::pair< std::string, function_signature_t > > &functions_declared, std::set< std::pair< std::string, function_signature_t > > &functions_defined, std::ostream &error_msgs) const
boost::phoenix::function< set_double_range_upper > set_double_range_upper_f
boost::phoenix::function< add_idxs > add_idxs_f
void operator()(function_decl_def &decl, bool &pass, std::ostream &error_msgs) const
void operator()(while_statement &ws, const statement &s) const
std::stringstream & error_msgs_
void operator()(const std::string &name, const var_origin &origin_allowed, variable &v, bool &pass, const variable_map &vm, std::ostream &error_msgs) const
boost::phoenix::function< unscope_locals > unscope_locals_f
void operator()(bool &pass, std::set< std::pair< std::string, function_signature_t > > &declared, std::set< std::pair< std::string, function_signature_t > > &defined, std::ostream &error_msgs) const
Declare result to be a template struct.
boost::phoenix::function< division_expr > division_f
boost::phoenix::function< unscope_variables > unscope_variables_f
void operator()(const sample &s, const variable_map &var_map, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< elt_division_expr > elt_division_f
Declare result to be a template struct.
boost::phoenix::function< identifier_to_var > identifier_to_var_f
void operator()(range &r, std::stringstream &) const
boost::phoenix::function< negate_expr > negate_expr_f
void operator()(variable_map &vm) const
void operator()(L &lhs, const R &rhs) const
boost::phoenix::function< copy_square_cholesky_dimension_if_necessary > copy_square_cholesky_dimension_if_necessary_f
boost::phoenix::function< validate_return_type > validate_return_type_f
boost::phoenix::function< add_fun_var > add_fun_var_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
boost::phoenix::function< add_while_condition > add_while_condition_f
boost::phoenix::function< validate_assignment > validate_assignment_f
boost::phoenix::function< validate_integrate_ode_control > validate_integrate_ode_control_f
Placeholder struct for boost::variant default ctors.
boost::phoenix::function< validate_declarations > validate_declarations_f
void operator()(no_op_statement &s) const
boost::phoenix::function< left_division_expr > left_division_f
boost::phoenix::function< set_void_return > set_void_return_f
boost::phoenix::function< modulus_expr > modulus_f
data_only_expression(std::stringstream &error_msgs, variable_map &var_map)
boost::phoenix::function< scope_lp > scope_lp_f
void operator()(conditional_statement &cs, const statement &s) const
void operator()(return_statement &s) const
boost::phoenix::function< deprecate_old_assignment_op > deprecate_old_assignment_op_f
Declare result to be a template struct.
void operator()(assignment &a, const var_origin &origin_allowed, bool &pass, variable_map &vm, std::ostream &error_msgs) const
void operator()(var_origin origin, bool &pass, std::ostream &error_msgs) const
boost::phoenix::function< validate_non_void_expression > validate_non_void_expression_f
void operator()(variable_map &vm) const
void operator()(bool &pass, const stan::lang::expression &expr, std::stringstream &error_msgs) const
void operator()(pos_iterator_t _begin, pos_iterator_t _end, pos_iterator_t _where, variable_map &vm, std::stringstream &error_msgs) const