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);
25 int num_dimss(std::vector<std::vector<stan::lang::expression> >& dimss);
42 template <
typename F,
typename T1>
61 template <
typename F,
typename T1,
typename T2>
80 template <
typename F,
typename T1,
typename T2,
typename T3>
99 template <
typename F,
typename T1,
typename T2,
typename T3,
typename T4>
118 template <
typename F,
typename T1,
typename T2,
typename T3,
119 typename T4,
typename T5>
138 template <
typename F,
typename T1,
typename T2,
typename T3,
139 typename T4,
typename T5,
typename T6>
140 struct result<F(T1, T2, T3, T4, T5, T6)> {
typedef void type; };
158 template <
typename F,
typename T1,
typename T2,
typename T3,
159 typename T4,
typename T5,
typename T6,
typename T7>
160 struct result<F(T1, T2, T3, T4, T5, T6, T7)> {
typedef void type; };
165 template <
typename L,
typename R>
166 void operator()(L& lhs,
const R& rhs)
const;
168 extern boost::phoenix::function<assign_lhs>
assign_lhs_f;
173 void operator()(
const expression& expr,
bool& pass,
174 std::ostream& error_msgs)
const;
180 void operator()(
const std::string& s,
188 std::ostream& error_msgs)
const;
190 extern boost::phoenix::function<addition_expr3>
addition3_f;
195 std::ostream& error_msgs)
const;
197 extern boost::phoenix::function<subtraction_expr3>
subtraction3_f;
201 void operator()(
size_t& lhs)
const;
212 std::ostream& error_msgs)
const;
214 extern boost::phoenix::function<validate_conditional_op>
221 const std::string& op,
const std::string& fun_name,
222 std::ostream& error_msgs)
const;
224 extern boost::phoenix::function<binary_op_expr>
binary_op_f;
228 void operator()(
const expr_type& arg_type,
230 std::ostream& error_msgs)
const;
232 extern boost::phoenix::function<validate_non_void_arg_function>
238 bool& pass, std::ostream& error_msgs)
const;
244 void operator()(
const std::string& identifier,
bool& allow_sampling,
247 extern boost::phoenix::function<set_allows_sampling_origin>
252 void operator()(
bool& pass,
253 std::set<std::pair<std::string,
255 std::set<std::pair<std::string,
257 std::ostream& error_msgs,
258 bool allow_undefined)
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;
322 void operator()(
omni_idx& val)
const;
328 void operator()(
const expression & e,
bool& pass)
const;
330 extern boost::phoenix::function<validate_int_expr_silent>
335 void operator()(
const expression & e,
bool& pass,
336 std::ostream& error_msgs)
const;
338 extern boost::phoenix::function<validate_int_expression_warn>
343 void operator()(
const expression & e,
bool& pass,
344 std::ostream& error_msgs)
const;
346 extern boost::phoenix::function<validate_ints_expression>
353 extern boost::phoenix::function<add_lp_var>
add_lp_var_f;
365 std::stringstream& error_msgs)
const;
372 bool& pass, std::stringstream& error_msgs)
const;
374 extern boost::phoenix::function<add_conditional_condition>
381 extern boost::phoenix::function<add_conditional_body>
386 void operator()(std::ostream& error_msgs)
const;
388 extern boost::phoenix::function<deprecate_old_assignment_op>
393 void operator()(
var_origin origin,
bool& pass, std::ostream& error_msgs)
396 extern boost::phoenix::function<validate_return_allowed>
401 void operator()(
var_origin origin,
bool& pass, std::ostream& error_msgs)
404 extern boost::phoenix::function<validate_void_return_allowed>
409 void operator()(
const std::string& name,
const var_origin& origin_allowed,
411 std::ostream& error_msgs)
const;
417 void operator()(
const assgn& a,
bool& pass, std::ostream& error_msgs)
433 bool& pass, std::ostream& error_msgs)
const;
440 std::stringstream& error_msgs)
const;
442 extern boost::phoenix::function<expression_as_statement>
447 void operator()(
const std::vector<var_decl>& var_decls,
variable_map& vm)
455 bool& pass, std::stringstream& error_msgs)
const;
467 void operator()(
const std::string& name, std::string& name_local,
469 std::stringstream& error_msgs)
const;
475 void operator()(
const std::string& name,
variable_map& vm)
const;
477 extern boost::phoenix::function<remove_loop_identifier>
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>
497 void operator()(
const expression& e,
bool& pass, std::ostream& error_msgs)
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;
574 std::ostream& error_msgs)
const;
582 std::ostream& error_msgs)
const;
589 std::ostream& error_msgs)
const;
596 std::ostream& error_msgs)
const;
598 extern boost::phoenix::function<division_expr>
division_f;
603 bool& pass, std::ostream& error_msgs)
const;
605 extern boost::phoenix::function<modulus_expr>
modulus_f;
610 std::ostream& error_msgs)
const;
617 std::ostream& error_msgs)
const;
619 extern boost::phoenix::function<elt_multiplication_expr>
625 std::ostream& error_msgs)
const;
627 extern boost::phoenix::function<elt_division_expr>
elt_division_f;
632 bool& pass, std::ostream& error_msgs)
const;
639 std::ostream& error_msgs)
const;
646 std::ostream& error_msgs)
const;
648 extern boost::phoenix::function<transpose_expr>
transpose_f;
652 void operator()(
expression& e, std::vector<idx>& idxs,
bool& pass,
653 std::ostream& error_msgs)
const;
655 extern boost::phoenix::function<add_idxs>
add_idxs_f;
660 std::vector<std::vector<stan::lang::expression> >& dimss,
661 bool& pass, std::ostream& error_msgs)
const;
663 extern boost::phoenix::function<add_expression_dimss>
669 std::ostream& error_msgs,
bool& pass)
const;
674 void operator()(
bool& pass, std::ostream& error_msgs)
const;
681 bool operator()(
const nil& )
const;
702 bool operator()(
const nil& )
const;
706 bool operator()(
const variable& x)
const;
709 bool operator()(
const fun& x)
const;
710 bool operator()(
const index_op& x)
const;
713 bool operator()(
const binary_op& x)
const;
714 bool operator()(
const unary_op& x)
const;
719 void operator()(
const bool& allow_constraints,
721 bool& pass, std::stringstream& error_msgs)
const;
723 extern boost::phoenix::function<validate_decl_constraints>
729 bool& pass, std::stringstream& error_msgs)
const;
731 extern boost::phoenix::function<validate_definition>
738 void operator()(
const std::string& identifier,
bool& pass,
739 std::stringstream& error_msgs)
const;
740 bool contains(
const std::set<std::string>& s,
741 const std::string& x)
const;
742 bool identifier_exists(
const std::string& identifier)
const;
743 void reserve(
const std::string& w);
752 extern boost::phoenix::function<copy_square_cholesky_dimension_if_necessary>
756 void operator()(
range& r, std::stringstream& )
const;
761 void operator()(
const expression& expr,
bool& pass,
762 std::stringstream& error_msgs)
const;
768 std::stringstream& error_msgs)
const;
774 std::stringstream& error_msgs)
const;
783 extern boost::phoenix::function<validate_int_data_expr>
787 void operator()(
const expression& expr,
bool& pass,
788 std::stringstream& error_msgs)
const;
790 extern boost::phoenix::function<validate_double_expr>
795 std::stringstream& error_msgs)
const;
797 extern boost::phoenix::function<set_double_range_lower>
802 std::stringstream& error_msgs)
const;
804 extern boost::phoenix::function<set_double_range_upper>
808 template <
typename T>
811 std::ostream& error_msgs)
814 extern boost::phoenix::function<add_var>
add_var_f;
817 void operator()(
bool in_loop,
bool& pass, std::ostream& error_msgs)
const;
822 void operator()(
const expression& e,
bool& pass,
823 std::ostream& error_msgs)
const;
An integer variable declaration and optional definition.
boost::phoenix::function< validate_return_allowed > validate_return_allowed_f
boost::phoenix::function< require_vbar > require_vbar_f
Structure to hold the declaration of a positive ordered vector.
boost::phoenix::function< set_void_function > set_void_function_f
Structure to wrap the variant type of statements.
boost::phoenix::function< add_while_body > add_while_body_f
boost::phoenix::function< set_int_range_upper > set_int_range_upper_f
AST node for the type delclaration for function arguments.
boost::phoenix::function< validate_assgn > validate_assgn_f
Structure to hold a row vector variable declaration.
boost::phoenix::function< set_var_type > set_var_type_f
AST node for assignment to variable with multi-indexing.
void set_fun_type(fun &fun, std::ostream &error_msgs)
boost::phoenix::function< set_int_range_lower > set_int_range_lower_f
boost::phoenix::function< binary_op_expr > binary_op_f
boost::phoenix::function< validate_expr_type3 > validate_expr_type3_f
boost::phoenix::function< deprecated_integrate_ode > deprecated_integrate_ode_f
Node for holding a double literal.
int num_dimss(std::vector< std::vector< stan::lang::expression > > &dimss)
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
boost::phoenix::function< validate_conditional_op > validate_conditional_op_f
Probability, optimization and sampling library.
Structure to hold an array expression.
Declare result to be a template struct.
boost::phoenix::function< deprecate_increment_log_prob > deprecate_increment_log_prob_f
Structure for an indexed expression.
boost::phoenix::function< program_error > program_error_f
Structure to hold a covariance matrix variable declaration.
Structure for function application.
bool has_prob_suffix(const std::string &s)
boost::spirit::line_pos_iterator< input_iterator_t > pos_iterator_t
Structure of the type of an expression, which consists of a base type and a number of dimensions...
A map from function names to their base declarations and their origin.
boost::phoenix::function< validate_ints_expression > validate_ints_expression_f
AST node for sampling statements.
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
Structure for integrate diff eq statement.
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...
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)
Structure to hold the declaration of a simplex.
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
Structure to hold a Cholesky factor for a correlation matrix variable declaration.
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
boost::phoenix::function< validate_non_void_arg_function > validate_non_void_arg_f
AST structure for a range object with a low and high value.
boost::phoenix::function< non_void_expression > non_void_expression_f
boost::phoenix::function< remove_loop_identifier > remove_loop_identifier_f
boost::phoenix::function< add_conditional_body > add_conditional_body_f
boost::phoenix::function< transpose_expr > transpose_f
boost::phoenix::function< validate_definition > validate_definition_f
boost::phoenix::function< multiplication_expr > multiplication_f
boost::phoenix::function< validate_identifier > validate_identifier_f
boost::phoenix::function< validate_int_expression_warn > validate_int_expression_warn_f
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
Structure to hold the declaration of a unit vector.
boost::phoenix::function< validate_decl_constraints > validate_decl_constraints_f
AST structure for representing all legal indexes.
boost::phoenix::function< add_expression_dimss > add_expression_dimss_f
boost::phoenix::function< set_array_expr_type > set_array_expr_type_f
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
boost::phoenix::function< validate_int_expr_silent > validate_int_expr_silent_f
std::stringstream & error_msgs_
boost::phoenix::function< is_prob_fun > is_prob_fun_f
int var_origin
The type of a variable indicating where a variable was declared.
Structure to hold a matrix variable declaration.
boost::phoenix::function< set_omni_idx > set_omni_idx_f
Structure to hold a Cholesky factor variable declaration.
std::pair< expr_type, std::vector< expr_type > > function_signature_t
The type of a function signature, mapping a vector of argument expression types to a result expressio...
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_
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< validate_double_expr > validate_double_expr_f
boost::phoenix::function< expression_as_statement > expression_as_statement_f
Structure to hold a column vector variable declaration.
boost::phoenix::function< validate_pmf_pdf_variate > validate_pmf_pdf_variate_f
The variant structure to hold a variable declaration.
boost::phoenix::function< add_lp_var > add_lp_var_f
Structure to hold a correlation matrix variable declaration.
AST node for representing while statements.
boost::phoenix::function< elt_multiplication_expr > elt_multiplication_f
AST structure for holding an expression with a sequence of indexes.
boost::phoenix::function< set_allows_sampling_origin > set_allows_sampling_origin_f
Structure for the conditional operator.
AST node for the no-operation statement.
boost::phoenix::function< logical_negate_expr > logical_negate_expr_f
An integer variable declaration and optional definition.
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
Structure to hold a variable.
boost::phoenix::function< set_double_range_upper > set_double_range_upper_f
boost::phoenix::function< add_idxs > add_idxs_f
Structure to hold the declaration of an ordered vector.
std::stringstream & error_msgs_
boost::phoenix::function< unscope_locals > unscope_locals_f
AST node for the return statement.
Declare result to be a template struct.
boost::phoenix::function< division_expr > division_f
boost::phoenix::function< unscope_variables > unscope_variables_f
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
boost::phoenix::function< validate_in_loop > validate_in_loop_f
boost::phoenix::function< negate_expr > negate_expr_f
AST structure for unary operations consisting of an operation and argument.
AST node for a function declaration and definition including return type name, arguments, and body.
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
Node for storing binary operations consisting of an operation and left and right arguments.
boost::phoenix::function< add_fun_var > add_fun_var_f
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
The nil structure used as a placeholder for undefined or empty values in several structures.
boost::phoenix::function< validate_declarations > validate_declarations_f
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
boost::phoenix::function< scope_lp > scope_lp_f
Structure for a diff eq integration statement with control parameters for the integrator.
boost::phoenix::function< deprecate_old_assignment_op > deprecate_old_assignment_op_f
AST node for conditional statements.
Declare result to be a template struct.
boost::phoenix::function< validate_non_void_expression > validate_non_void_expression_f
AST node for assignment statements.