1 #ifndef STAN_LANG_GRAMMARS_SEMANTIC_ACTIONS_DEF_CPP
2 #define STAN_LANG_GRAMMARS_SEMANTIC_ACTIONS_DEF_CPP
7 #include <boost/format.hpp>
8 #include <boost/spirit/include/qi.hpp>
9 #include <boost/variant/apply_visitor.hpp>
10 #include <boost/variant/recursive_variant.hpp>
33 const std::string& new_suffix,
fun& f) {
40 bool deprecate_fun(
const std::string& old_name,
const std::string& new_name,
41 fun& f, std::ostream& msgs) {
42 if (f.
name_ != old_name)
return false;
45 msgs <<
"Warning: Function name '" << old_name <<
"' is deprecated"
46 <<
" and will be removed in a later release; please replace"
47 <<
" with '" << new_name <<
"'" << std::endl;
52 const std::string& replacement,
fun& f,
55 msgs <<
"Warning: Deprecated function '" << f.
name_ <<
"';"
56 <<
" please replace suffix '" << deprecated_suffix
57 <<
"' with " << replacement << std::endl;
62 std::stringstream& error_msgs) {
65 error_msgs <<
"expression denoting real required; found type="
73 std::vector<expr_type> arg_types;
74 for (
size_t i = 0; i < fun.
args_.size(); ++i)
75 arg_types.push_back(fun.
args_[i].expression_type());
80 int num_dimss(std::vector<std::vector<stan::lang::expression> >& dimss) {
82 for (
size_t i = 0; i < dimss.size(); ++i)
83 sum += dimss[i].size();
87 template <
typename L,
typename R>
106 const std::vector<var_decl>&)
const;
108 const std::vector<idx>&)
const;
110 std::vector<std::vector<expression> >&,
111 const std::vector<std::vector<expression> >&)
const;
116 std::ostream& error_msgs)
const {
119 error_msgs <<
"expression is ill formed" << std::endl;
130 std::ostream& error_msgs)
const {
136 std::vector<expression> args;
137 args.push_back(expr1);
138 args.push_back(expr2);
147 std::ostream& error_msgs)
const {
153 std::vector<expression> args;
154 args.push_back(expr1);
155 args.push_back(expr2);
156 fun f(
"subtract", args);
170 std::ostream& error_msgs)
const {
174 error_msgs <<
"condition in ternary expression must be"
175 <<
" primitive int or real;"
176 <<
" found type=" << cond_type
184 true_val_base_type = true_val_type.
base_type_;
189 false_val_base_type = false_val_type.
base_type_;
191 bool types_compatible
192 = (true_val_type.is_primitive()
193 && false_val_type.is_primitive()
194 && (true_val_base_type == false_val_base_type
196 && false_val_base_type ==
INT_T)
197 || (true_val_base_type ==
INT_T
198 && false_val_base_type ==
DOUBLE_T)))
199 || (true_val_type == false_val_type);
201 if (!types_compatible) {
202 error_msgs <<
"base type mismatch in ternary expression,"
203 <<
" expression when true is: ";
205 error_msgs <<
"; expression when false is: ";
207 error_msgs << std::endl;
212 if (!true_val_type.is_primitive()) {
213 conditional_op.
type_ = true_val_type;
215 conditional_op.
type_ =
216 (true_val_base_type == false_val_base_type) ?
220 boost::phoenix::function<validate_conditional_op>
224 const std::string& op,
225 const std::string& fun_name,
226 std::ostream& error_msgs)
const {
229 error_msgs <<
"binary infix operator " << op
230 <<
" with functional interpretation " << fun_name
231 <<
" requires arguments or primitive type (int or real)"
237 std::vector<expression> args;
238 args.push_back(expr1);
239 args.push_back(expr2);
240 fun f(fun_name, args);
248 std::ostream& error_msgs)
const {
251 error_msgs <<
"Functions cannot contain void argument types; "
252 <<
"found void argument."
255 boost::phoenix::function<validate_non_void_arg_function>
260 std::ostream& error_msgs)
const {
262 error_msgs <<
"Void return type may not have dimensions declared."
275 bool& allow_sampling,
277 bool is_void_function_origin
280 allow_sampling =
true;
281 origin = is_void_function_origin
284 }
else if (
ends_with(
"_rng", identifier)) {
285 allow_sampling =
false;
286 origin = is_void_function_origin
290 allow_sampling =
false;
291 origin = is_void_function_origin
296 boost::phoenix::function<set_allows_sampling_origin>
300 std::set<std::pair<std::string,
302 std::set<std::pair<std::string,
304 std::ostream& error_msgs)
const {
308 typedef set<pair<string, function_signature_t> >::iterator iterator_t;
309 for (iterator_t it = declared.begin(); it != declared.end(); ++it) {
310 if (defined.find(*it) == defined.end()) {
311 error_msgs <<
"Function declared, but not defined."
312 <<
" Function name=" << (*it).first
324 const std::pair<std::string,
326 bool name_only =
true) {
327 for (std::set<std::pair<std::string,
330 it != existing.end();
332 if (name_sig.first == (*it).first
334 || name_sig.second.second == (*it).second.second))
340 std::ostream& error_msgs)
const {
347 error_msgs <<
"Parse Error. Probability function already defined"
348 <<
" for " << dist_name << std::endl;
357 error_msgs <<
" Parse Error. CDF already defined for "
358 << dist_name << std::endl;
367 error_msgs <<
" Parse Error. CCDF already defined for "
368 << dist_name << std::endl;
378 std::set<std::pair<std::string, function_signature_t> >&
380 std::set<std::pair<std::string, function_signature_t> >&
382 std::ostream& error_msgs)
const {
386 std::vector<expr_type> arg_types;
387 for (
size_t i = 0; i < decl.
arg_decls_.size(); ++i)
392 std::pair<std::string, function_signature_t> name_sig(decl.
name_, sig);
395 &&
fun_exists(functions_declared, name_sig)) {
396 error_msgs <<
"Parse Error. Function already declared, name="
403 if (
fun_exists(functions_defined, name_sig)) {
404 error_msgs <<
"Parse Error. Function already defined, name="
413 error_msgs <<
"Parse Error. Function system defined, name="
421 error_msgs <<
"Parse Error. Probability density functions require"
422 <<
" real variates (first argument)."
423 <<
" Found type = " << arg_types[0] << std::endl;
428 error_msgs <<
"Parse Error. Probability mass functions require"
429 <<
" integer variates (first argument)."
430 <<
" Found type = " << arg_types[0] << std::endl;
436 if (functions_declared.find(name_sig) == functions_declared.end()) {
437 functions_declared.insert(name_sig);
439 .
add(decl.
name_, result_type, arg_types);
445 functions_defined.insert(name_sig);
453 std::ostream& error_msgs)
458 error_msgs <<
"Parse Error. Probability functions require"
459 <<
" at least one argument." << std::endl;
465 error_msgs <<
"Parse Error. Probability density functions require"
466 <<
" real variates (first argument)."
467 <<
" Found type = " << variate_type << std::endl;
472 error_msgs <<
"Parse Error. Probability mass functions require"
473 <<
" integer variates (first argument)."
474 <<
" Found type = " << variate_type << std::endl;
479 boost::phoenix::function<validate_pmf_pdf_variate>
484 std::ostream& error_msgs)
const {
489 error_msgs <<
"Improper return in body of function." << std::endl;
500 error_msgs <<
"Require real return type for probability functions"
501 <<
" ending in _log, _lpdf, _lpmf, _lcdf, or _lccdf."
517 for (
size_t i = 0; i < decl.
arg_decls_.size(); ++i)
523 std::ostream& error_msgs)
const {
527 error_msgs <<
"duplicate declaration of variable, name="
529 <<
"; attempt to redeclare as function argument"
530 <<
"; original declaration as ";
532 error_msgs << std::endl;
551 boost::phoenix::function<validate_int_expression>
555 std::ostream& error_msgs)
const {
557 error_msgs <<
"index must be integer; found type=";
559 error_msgs << std::endl;
566 error_msgs <<
"index must be integer or 1D integer array;"
567 <<
" found number of dimensions="
580 boost::phoenix::function<validate_ints_expression>
602 std::stringstream& error_msgs)
const {
603 using boost::spirit::get_line;
607 size_t idx_errline = get_line(_where);
609 error_msgs << std::endl;
611 if (idx_errline > 0) {
612 error_msgs <<
"ERROR at line " << idx_errline
613 << std::endl << std::endl;
615 std::basic_stringstream<char> sprogram;
616 sprogram << boost::make_iterator_range(_begin, _end);
619 size_t idx_errcol = 0;
620 idx_errcol = get_column(_begin, _where) - 1;
622 std::string lineno =
"";
623 format fmt_lineno(
"% 3d: ");
625 std::string line_2before =
"";
626 std::string line_before =
"";
627 std::string line_err =
"";
628 std::string line_after =
"";
631 size_t idx_before = idx_errline - 1;
632 if (idx_before > 0) {
634 while (idx_before > idx_line) {
635 line_2before = line_before;
636 std::getline(sprogram, line_before);
639 if (line_2before.length() > 0) {
640 lineno = str(fmt_lineno % (idx_before - 1) );
641 error_msgs << lineno << line_2before << std::endl;
643 lineno = str(fmt_lineno % idx_before);
644 error_msgs << lineno << line_before << std::endl;
647 std::getline(sprogram, line_err);
648 lineno = str(fmt_lineno % idx_errline);
649 error_msgs << lineno << line_err << std::endl
650 << setw(idx_errcol + lineno.length()) <<
"^" << std::endl;
652 if (!sprogram.eof()) {
653 std::getline(sprogram, line_after);
654 lineno = str(fmt_lineno % (idx_errline+1));
655 error_msgs << lineno << line_after << std::endl;
658 error_msgs << std::endl;
665 std::stringstream& error_msgs)
668 error_msgs <<
"conditions in if-else statement must be"
669 <<
" primitive int or real;"
679 boost::phoenix::function<add_conditional_condition>
690 error_msgs <<
"Warning (non-fatal): assignment operator <- deprecated"
691 <<
" in the Stan language;"
695 boost::phoenix::function<deprecate_old_assignment_op>
699 std::ostream& error_msgs)
const {
703 error_msgs <<
"Returns only allowed from function bodies."
714 std::ostream& error_msgs)
719 error_msgs <<
"Void returns only allowed from function"
720 <<
" bodies of void return type."
727 boost::phoenix::function<validate_void_return_allowed>
734 std::ostream& error_msgs)
const {
743 && lhs_origin != origin_allowed) {
764 std::ostream& error_msgs)
const {
770 error_msgs <<
"Left-hand side indexing incompatible with variable."
780 bool types_compatible
781 = lhs_base_type == rhs_base_type
783 if (!types_compatible) {
784 error_msgs <<
"base type mismatch in assignment"
785 <<
"; variable name="
789 error_msgs <<
"; right-hand side type=";
791 error_msgs << std::endl;
797 error_msgs <<
"dimension mismatch in assignment"
798 <<
"; variable name="
800 <<
", num dimensions given="
802 <<
"; right-hand side dimensions="
811 error_msgs <<
"WARNING: left-hand side variable"
812 <<
" (name=" << name <<
")"
813 <<
" occurs on right-hand side of assignment, causing"
814 <<
" inefficient deep copy to avoid aliasing."
825 std::ostream& error_msgs)
const {
829 error_msgs <<
"unknown variable in assignment"
840 && lhs_origin != origin_allowed) {
841 error_msgs <<
"attempt to assign variable in wrong block."
842 <<
" left-hand-side variable origin=";
844 error_msgs << std::endl;
856 error_msgs <<
"Illegal to assign to function argument variables."
858 <<
"Use local variables instead."
874 error_msgs <<
"too many indexes for variable "
875 <<
"; variable name = " << name
876 <<
"; num dimensions given = " << num_index_dims
877 <<
"; variable array dimensions = " << lhs_var_num_dims
886 bool types_compatible
887 = lhs_base_type == rhs_base_type
889 if (!types_compatible) {
890 error_msgs <<
"base type mismatch in assignment"
891 <<
"; variable name = "
895 error_msgs <<
"; right-hand side type=";
897 error_msgs << std::endl;
903 error_msgs <<
"dimension mismatch in assignment"
904 <<
"; variable name = "
906 <<
", num dimensions given = "
908 <<
"; right-hand side dimensions = "
920 const std::vector<expr_type>& arg_types) {
927 const std::vector<expr_type>& arg_types,
928 std::ostream& error_msgs) {
942 std::ostream& error_msgs)
const {
943 static const bool user_facing =
true;
944 std::vector<expr_type> arg_types;
946 for (
size_t i = 0; i < s.
dist_.
args_.size(); ++i)
947 arg_types.push_back(s.
dist_.
args_[i].expression_type());
950 std::string internal_function_name =
get_prob_fun(function_name);
951 if (internal_function_name.size() == 0) {
953 error_msgs <<
"Error: couldn't find distribution named "
954 << function_name << std::endl;
958 if ((internal_function_name.find(
"multiply_log") != std::string::npos)
959 || (internal_function_name.find(
"binomial_coefficient_log")
960 != std::string::npos)) {
961 error_msgs <<
"Only distribution names can be used with"
962 <<
" sampling (~) notation; found non-distribution"
963 <<
" function: " << function_name
969 if (internal_function_name.find(
"cdf_log") != std::string::npos) {
970 error_msgs <<
"CDF and CCDF functions may not be used with"
971 <<
" sampling notation."
972 <<
" Use increment_log_prob("
973 << internal_function_name <<
"(...)) instead."
979 if (internal_function_name ==
"lkj_cov_log") {
980 error_msgs <<
"Warning: the lkj_cov_log() sampling distribution"
981 <<
" is deprecated. It will be removed in Stan 3."
983 <<
"Code LKJ covariance in terms of an lkj_corr()"
984 <<
" distribution on a correlation matrix"
985 <<
" and independent lognormals on the scales."
986 << std::endl << std::endl;
990 error_msgs <<
"require real scalar return type for"
991 <<
" probability function." << std::endl;
998 error_msgs <<
"Warning (non-fatal):"
1000 <<
"Left-hand side of sampling statement (~) may contain a"
1001 <<
" non-linear transform of a parameter or local variable."
1003 <<
"If so, you need to call increment_log_prob() with"
1004 <<
" the log absolute determinant of the Jacobian of"
1005 <<
" the transform."
1007 <<
"Left-hand-side of sampling statement:"
1011 error_msgs <<
" ~ " << function_name <<
"(...)"
1017 error_msgs <<
"Outcomes in truncated distributions"
1018 <<
" must be univariate."
1020 <<
" Found outcome expression: ";
1022 error_msgs << std::endl
1023 <<
" with non-univariate type: "
1029 for (
size_t i = 0; i < s.
dist_.
args_.size(); ++i)
1031 error_msgs <<
"Parameters in truncated distributions"
1032 <<
" must be univariate."
1034 <<
" Found parameter expression: ";
1036 error_msgs << std::endl
1037 <<
" with non-univariate type: "
1046 error_msgs <<
"Lower bounds in truncated distributions"
1047 <<
" must be univariate."
1049 <<
" Found lower bound expression: ";
1051 error_msgs << std::endl
1052 <<
" with non-univariate type: "
1060 error_msgs <<
"Upper bounds in truncated distributions"
1061 <<
" must be univariate."
1063 <<
" Found upper bound expression: ";
1065 error_msgs << std::endl
1066 <<
" with non-univariate type: "
1076 std::vector<expr_type> arg_types_trunc(arg_types);
1081 error_msgs <<
"lower truncation not defined for specified"
1088 error_msgs <<
"lower bound in truncation type does not match"
1089 <<
" sampled variate in distribution's type"
1097 std::vector<expr_type> arg_types_trunc(arg_types);
1102 error_msgs <<
"upper truncation not defined for"
1103 <<
" specified arguments to "
1110 error_msgs <<
"upper bound in truncation type does not match"
1111 <<
" sampled variate in distribution's type"
1119 std::vector<expr_type> arg_types_trunc(arg_types);
1124 error_msgs <<
"lower truncation not defined for specified"
1131 error_msgs <<
"lower bound in truncation type does not match"
1132 <<
" sampled variate in distribution's type"
1145 std::stringstream& error_msgs)
const {
1146 static const bool user_facing =
true;
1148 error_msgs <<
"Illegal statement beginning with non-void"
1149 <<
" expression parsed as"
1150 << std::endl <<
" ";
1152 error_msgs << std::endl
1153 <<
"Not a legal assignment, sampling, or function"
1154 <<
" statement. Note that"
1156 <<
" * Assignment statements only allow variables"
1157 <<
" (with optional indexes) on the left;"
1159 <<
" if you see an outer function logical_lt (<)"
1160 <<
" with negated (-) second argument,"
1162 <<
" it indicates an assignment statement A <- B"
1163 <<
" with illegal left"
1165 <<
" side A parsed as expression (A < (-B))."
1167 <<
" * Sampling statements allow arbitrary"
1168 <<
" value-denoting expressions on the left."
1170 <<
" * Functions used as statements must be"
1171 <<
" declared to have void returns"
1172 << std::endl << std::endl;
1182 for (
size_t i = 0; i < var_decls.size(); ++i)
1183 vm.
remove(var_decls[i].name());
1189 std::stringstream& error_msgs)
const {
1192 error_msgs <<
"conditions in while statement must be primitive"
1208 std::string& name_local,
1210 std::stringstream& error_msgs)
const {
1214 error_msgs <<
"ERROR: loop variable already declared."
1215 <<
" variable name=\"" << name <<
"\"" << std::endl;
1230 std::stringstream& error_msgs)
1234 error_msgs <<
"expression denoting integer required; found type="
1240 std::stringstream& error_msgs)
const {
1241 error_msgs <<
"Warning (non-fatal): increment_log_prob(...);"
1242 <<
" is deprecated and will be removed in the future."
1244 <<
" Use target += ...; instead."
1247 boost::phoenix::function<deprecate_increment_log_prob>
1252 std::stringstream& error_msgs)
1254 pass = allow_sample;
1256 error_msgs <<
"Sampling statements (~) and increment_log_prob() are"
1258 <<
"only allowed in the model block."
1265 std::ostream& error_msgs)
1269 error_msgs <<
"attempt to increment log prob with void expression"
1272 boost::phoenix::function<validate_non_void_expression>
1297 error_msgs <<
"Warning: the integrate_ode() function is deprecated"
1298 <<
" in the Stan language; use integrate_ode_rk45() [non-stiff]"
1299 <<
" or integrate_ode_bdf() [stiff] instead."
1302 boost::phoenix::function<deprecated_integrate_ode>
1309 std::ostream& error_msgs) {
1313 std::vector<expr_type> sys_arg_types;
1321 .
is_defined(ode_fun.system_function_name_, system_signature)) {
1322 error_msgs <<
"first argument to "
1323 << ode_fun.integration_function_name_
1324 <<
" must be a function with signature"
1325 <<
" (real, real[], real[], real[], int[]) : real[] ";
1331 error_msgs <<
"second argument to "
1332 << ode_fun.integration_function_name_
1333 <<
" must have type real[] for intial system state;"
1335 << ode_fun.y0_.expression_type()
1339 if (!ode_fun.t0_.expression_type().is_primitive()) {
1340 error_msgs <<
"third argument to "
1341 << ode_fun.integration_function_name_
1342 <<
" must have type real or int for initial time; found type="
1343 << ode_fun.t0_.expression_type()
1348 error_msgs <<
"fourth argument to "
1349 << ode_fun.integration_function_name_
1350 <<
" must have type real[]"
1351 <<
" for requested solution times; found type="
1352 << ode_fun.ts_.expression_type()
1357 error_msgs <<
"fifth argument to "
1358 << ode_fun.integration_function_name_
1359 <<
" must have type real[] for parameters; found type="
1360 << ode_fun.theta_.expression_type()
1365 error_msgs <<
"sixth argument to "
1366 << ode_fun.integration_function_name_
1367 <<
" must have type real[] for real data; found type="
1368 << ode_fun.x_.expression_type()
1373 error_msgs <<
"seventh argument to "
1374 << ode_fun.integration_function_name_
1375 <<
" must have type int[] for integer data; found type="
1376 << ode_fun.x_int_.expression_type()
1382 if (
has_var(ode_fun.t0_, var_map)) {
1383 error_msgs <<
"third argument to "
1384 << ode_fun.integration_function_name_
1385 <<
" (initial times)"
1386 <<
" must be data only and not reference parameters";
1389 if (
has_var(ode_fun.ts_, var_map)) {
1390 error_msgs <<
"fourth argument to "
1391 << ode_fun.integration_function_name_
1392 <<
" (solution times)"
1393 <<
" must be data only and not reference parameters";
1396 if (
has_var(ode_fun.x_, var_map)) {
1397 error_msgs <<
"fifth argument to "
1398 << ode_fun.integration_function_name_
1400 <<
" must be data only and not reference parameters";
1408 std::ostream& error_msgs)
const {
1417 std::ostream& error_msgs)
const {
1421 error_msgs <<
"eight argument to "
1423 <<
" (relative tolerance) must have type real or int;"
1430 error_msgs <<
"ninth argument to "
1432 <<
" (absolute tolerance) must have type real or int;"
1439 error_msgs <<
"tenth argument to "
1441 <<
" (max steps) must have type real or int;"
1450 error_msgs <<
"eight argument to "
1452 <<
" (real data) must be data only"
1453 <<
" and not depend on parameters";
1457 error_msgs <<
"ninth argument to "
1459 <<
" (real data) must be data only"
1460 <<
" and not depend parameters";
1464 error_msgs <<
"tenth argument to "
1466 <<
" (real data) must be data only"
1467 <<
" and not depend on parameters";
1471 boost::phoenix::function<validate_integrate_ode_control>
1477 std::ostream& error_msgs)
const {
1478 if (fun.
name_ ==
"get_lp")
1479 error_msgs <<
"Warning (non-fatal): get_lp() function deprecated."
1481 <<
" It will be removed in a future release."
1483 <<
" Use target() instead."
1485 if (fun.
name_ ==
"target")
1486 fun.
name_ =
"get_lp";
1488 std::vector<expr_type> arg_types;
1489 for (
size_t i = 0; i < fun.
args_.size(); ++i)
1490 arg_types.push_back(fun.
args_[i].expression_type());
1500 deprecate_fun(
"binomial_coefficient_log",
"lchoose", fun, error_msgs)
1501 ||
deprecate_fun(
"multiply_log",
"lmultiply", fun, error_msgs)
1505 "'_lpdf' for density functions or '_lpmf' for mass functions",
1519 error_msgs <<
"random number generators only allowed in"
1520 <<
" generated quantities block or"
1521 <<
" user-defined functions with names ending in _rng"
1522 <<
"; found function=" << fun.
name_
1525 error_msgs << std::endl;
1538 error_msgs <<
"Function target() or functions suffixed with _lp only"
1539 <<
" allowed in transformed parameter block, model block"
1541 <<
"or the body of a function with suffix _lp."
1543 <<
"Found function = "
1544 << (fun.
name_ ==
"get_lp" ?
"target or get_lp" : fun.
name_)
1547 error_msgs << std::endl;
1553 if (fun.
name_ ==
"max" || fun.
name_ ==
"min") {
1554 if (fun.
args_.size() == 2) {
1555 if (fun.
args_[0].expression_type().is_primitive_int()
1556 && fun.
args_[1].expression_type().is_primitive_int()) {
1562 if (fun.
name_ ==
"abs"
1563 && fun.
args_.size() > 0
1564 && fun.
args_[0].expression_type().is_primitive_double()) {
1565 error_msgs <<
"Warning: Function abs(real) is deprecated"
1566 <<
" in the Stan language."
1568 <<
" It will be removed in a future release."
1570 <<
" Use fabs(real) instead."
1571 << std::endl << std::endl;
1574 if (fun.
name_ ==
"lkj_cov_log") {
1575 error_msgs <<
"Warning: the lkj_cov_log() function"
1576 <<
" is deprecated. It will be removed in Stan 3."
1578 <<
"Code LKJ covariance in terms of an lkj_corr()"
1579 <<
" distribution on a correlation matrix"
1580 <<
" and independent lognormals on the scales."
1581 << std::endl << std::endl;
1593 std::ostream& error_msgs)
const {
1596 error_msgs <<
"arguments to ^ must be primitive (real or int)"
1597 <<
"; cannot exponentiate "
1603 error_msgs << std::endl;
1607 std::vector<expression> args;
1608 args.push_back(expr1);
1609 args.push_back(expr2);
1618 std::ostream& error_msgs)
const {
1624 std::vector<expression> args;
1625 args.push_back(expr1);
1626 args.push_back(expr2);
1627 fun f(
"multiply", args);
1635 std::ostream& error_msgs)
const {
1636 static const bool user_facing =
true;
1644 std::vector<expression> args;
1645 args.push_back(expr1);
1646 args.push_back(expr2);
1650 error_msgs <<
"Warning: integer division"
1651 <<
" implicitly rounds to integer."
1652 <<
" Found int division: ";
1654 error_msgs <<
" / ";
1656 error_msgs << std::endl
1657 <<
" Positive values rounded down,"
1658 <<
" negative values rounded up or down"
1659 <<
" in platform-dependent way."
1662 fun f(
"divide", args);
1670 fun f(
"mdivide_right", args);
1675 fun f(
"divide", args);
1683 bool& pass, std::ostream& error_msgs)
const {
1686 error_msgs <<
"both operands of % must be int"
1687 <<
"; cannot modulo "
1691 error_msgs << std::endl;
1695 std::vector<expression> args;
1696 args.push_back(expr1);
1697 args.push_back(expr2);
1698 fun f(
"modulus", args);
1706 std::ostream& error_msgs)
const {
1707 std::vector<expression> args;
1708 args.push_back(expr1);
1709 args.push_back(expr2);
1713 fun f(
"mdivide_left", args);
1719 fun f(
"mdivide_left", args);
1728 std::ostream& error_msgs)
const {
1734 std::vector<expression> args;
1735 args.push_back(expr1);
1736 args.push_back(expr2);
1737 fun f(
"elt_multiply", args);
1745 std::ostream& error_msgs)
const {
1751 std::vector<expression> args;
1752 args.push_back(expr1);
1753 args.push_back(expr2);
1754 fun f(
"elt_divide", args);
1762 std::ostream& error_msgs)
const {
1767 std::vector<expression> args;
1768 args.push_back(expr);
1769 fun f(
"minus", args);
1777 std::ostream& error_msgs)
const {
1779 error_msgs <<
"logical negation operator !"
1780 <<
" only applies to int or real types; ";
1783 std::vector<expression> args;
1784 args.push_back(expr);
1785 fun f(
"logical_negation", args);
1792 std::ostream& error_msgs)
const {
1795 std::vector<expression> args;
1796 args.push_back(expr);
1797 fun f(
"transpose", args);
1805 bool& pass, std::ostream& error_msgs)
const {
1809 error_msgs <<
"Indexed expression must have at least as many"
1810 <<
" dimensions as number of indexes supplied:"
1812 <<
" indexed expression dims="
1814 <<
"; num indexes=" << idxs.size()
1820 std::vector<std::vector<stan::lang::expression> >& dimss,
1821 bool& pass, std::ostream& error_msgs)
const {
1825 if (expr_dims < index_dims) {
1826 error_msgs <<
"Indexed expression must have at least as many"
1827 <<
" dimensions as number of indexes supplied: "
1829 <<
" indexed expression dimensionality = " << expr_dims
1830 <<
"; indexes supplied = " << dimss.size()
1837 error_msgs <<
"Indexed expression must have at least as many"
1838 <<
" dimensions as number of indexes supplied."
1850 std::ostream& error_msgs,
bool& pass)
const {
1851 std::string name = var_expr.
name_;
1852 if (name == std::string(
"lp__")) {
1853 error_msgs << std::endl
1854 <<
"ERROR (fatal): Use of lp__ is no longer supported."
1856 <<
" Use target += ... statement to increment log density."
1858 <<
" Use target() function to get log density."
1862 }
else if (name == std::string(
"params_r__")) {
1863 error_msgs << std::endl <<
"WARNING:" << std::endl
1864 <<
" Direct access to params_r__ yields an inconsistent"
1865 <<
" statistical model in isolation and no guarantee is"
1866 <<
" made that this model will yield valid inferences."
1868 <<
" Moreover, access to params_r__ is unsupported"
1869 <<
" and the variable may be removed without notice."
1876 error_msgs <<
"variable \"" << name <<
'"' <<
" does not exist."
1885 std::stringstream& error_msgs)
1886 : error_msgs_(error_msgs) { }
1895 <<
" found range constraint." << std::endl;
1904 <<
" found range constraint." << std::endl;
1913 <<
" found range constraint." << std::endl;
1922 <<
" found range constraint." << std::endl;
1931 <<
" found range constraint." << std::endl;
1938 error_msgs_ <<
"require unconstrained variable declaration."
1939 <<
" found unit_vector." << std::endl;
1944 error_msgs_ <<
"require unconstrained variable declaration."
1945 <<
" found simplex." << std::endl;
1950 error_msgs_ <<
"require unconstrained variable declaration."
1951 <<
" found ordered." << std::endl;
1956 error_msgs_ <<
"require unconstrained variable declaration."
1957 <<
" found positive_ordered." << std::endl;
1962 error_msgs_ <<
"require unconstrained variable declaration."
1963 <<
" found cholesky_factor." << std::endl;
1968 error_msgs_ <<
"require unconstrained variable declaration."
1969 <<
" found cholesky_factor_corr." << std::endl;
1974 error_msgs_ <<
"require unconstrained variable declaration."
1975 <<
" found cov_matrix." << std::endl;
1980 error_msgs_ <<
"require unconstrained variable declaration."
1981 <<
" found corr_matrix." << std::endl;
1987 : error_msgs_(error_msgs),
2000 for (
size_t i = 0; i < x.
args_.size(); ++i)
2001 if (!boost::apply_visitor(*
this, x.
args_[i].expr_))
2012 <<
" in dimension declarations."
2014 <<
" found variable=" << x.
name_
2015 <<
"; declared in block=";
2022 return boost::apply_visitor(*
this, x.
y0_.
expr_)
2027 return boost::apply_visitor(*
this, x.
y0_.
expr_)
2031 for (
size_t i = 0; i < x.
args_.size(); ++i)
2032 if (!boost::apply_visitor(*
this, x.
args_[i].expr_))
2037 if (!boost::apply_visitor(*
this, x.
expr_.
expr_))
2039 for (
size_t i = 0; i < x.
dimss_.size(); ++i)
2040 for (
size_t j = 0; j < x.
dimss_[i].size(); ++j)
2041 if (!boost::apply_visitor(*
this, x.
dimss_[i][j].expr_))
2046 return boost::apply_visitor(*
this, x.
expr_.
expr_);
2049 return boost::apply_visitor(*
this, x.
cond_.
expr_)
2054 return boost::apply_visitor(*
this, x.
left.
expr_)
2055 && boost::apply_visitor(*
this, x.
right.
expr_);
2062 const bool& declaration_ok,
2065 std::stringstream& error_msgs)
2067 if (!declaration_ok) {
2068 error_msgs <<
"Problem with declaration." << std::endl;
2072 if (allow_constraints) {
2077 pass = boost::apply_visitor(vis, var_decl.
decl_);
2079 boost::phoenix::function<validate_decl_constraints>
2086 const std::string& x)
const {
2087 return s.find(x) != s.end();
2130 reserve(
"cholesky_factor_cov");
2131 reserve(
"cholesky_factor_corr");
2244 set<string> fun_names = sigs.
key_set();
2245 for (set<string>::iterator it = fun_names.begin();
2246 it != fun_names.end();
2254 std::stringstream& error_msgs)
const {
2255 int len = identifier.size();
2257 && identifier[len-1] ==
'_'
2258 && identifier[len-2] ==
'_') {
2259 error_msgs <<
"variable identifier (name) may"
2260 <<
" not end in double underscore (__)"
2262 <<
" found identifer=" << identifier << std::endl;
2266 size_t period_position = identifier.find(
'.');
2267 if (period_position != std::string::npos) {
2268 error_msgs <<
"variable identifier may not contain a period (.)"
2270 <<
" found period at position (indexed from 0)="
2273 <<
" found identifier=" << identifier
2279 error_msgs <<
"variable identifier (name) may not be reserved word"
2281 <<
" found identifier=" << identifier
2294 var_decl.
N_ = var_decl.
M_;
2296 boost::phoenix::function<copy_square_cholesky_dimension_if_necessary>
2300 std::stringstream& )
const {
2308 std::stringstream& error_msgs)
const {
2310 error_msgs <<
"expression denoting integer required; found type="
2322 std::stringstream& error_msgs)
const {
2325 validator(expr, pass, error_msgs);
2332 std::stringstream& error_msgs)
const {
2335 validator(expr, pass, error_msgs);
2342 std::stringstream& error_msgs)
2345 error_msgs <<
"dimension declaration requires expression"
2346 <<
" denoting integer; found type="
2352 bool only_data_dimensions = boost::apply_visitor(vis, expr.
expr_);
2353 pass = only_data_dimensions;
2365 std::stringstream& error_msgs)
2375 std::stringstream& error_msgs)
2382 template <
typename T>
2385 std::ostream& error_msgs)
const {
2386 if (vm.
exists(var_decl.name_)) {
2389 error_msgs <<
"duplicate declaration of variable, name="
2392 error_msgs <<
"; attempt to redeclare as ";
2395 error_msgs <<
"; original declaration as ";
2398 error_msgs << std::endl;
2399 var_decl_result = var_decl;
2403 && var_decl.base_type_ ==
INT_T) {
2405 error_msgs <<
"integer parameters or transformed parameters"
2406 <<
" are not allowed; "
2407 <<
" found declared type int, parameter name="
2410 var_decl_result = var_decl;
2414 vm.
add(var_decl.name_, var_decl, vo);
2415 var_decl_result = var_decl;
2421 std::ostream&)
const;
2424 std::ostream&)
const;
2427 std::ostream&)
const;
2430 std::ostream&)
const;
2433 std::ostream&)
const;
2436 std::ostream&)
const;
2439 std::ostream&)
const;
2442 std::ostream&)
const;
2446 std::ostream&)
const;
2450 std::ostream&)
const;
2453 std::ostream&)
const;
2456 std::ostream&)
const;
2459 std::ostream&)
const;
expr_type get_result_type(const std::string &name, const std::vector< expr_type > &args, std::ostream &error_msgs, bool sampling_error_style=false)
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
bool fun_exists(const std::set< std::pair< std::string, function_signature_t > > &existing, const std::pair< std::string, function_signature_t > &name_sig, bool name_only=true)
std::string strip_ccdf_suffix(const std::string &dist_fun)
boost::phoenix::function< set_void_function > set_void_function_f
bool lhs_var_occurs_on_rhs() const
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
void add(const std::string &name, const expr_type &result_type, const std::vector< expr_type > &arg_types)
boost::phoenix::function< add_while_body > add_while_body_f
void operator()(const std::string &identifier, bool &pass, std::stringstream &error_msgs) const
const int function_argument_origin
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
bool has_lp_suffix(const std::string &s)
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
std::vector< expression > dims_
boost::phoenix::function< set_int_range_lower > set_int_range_lower_f
std::string original_name_
void operator()(const expression &expr, bool &pass, std::stringstream &error_msgs) const
boost::phoenix::function< binary_op_expr > binary_op_f
std::string strip_cdf_suffix(const std::string &dist_fun)
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)
const int parameter_origin
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_
bool has_cdf_suffix(const std::string &name)
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
const int function_argument_origin_rng
void operator()(function_decl_def &decl, bool &pass, std::ostream &error_msgs) const
Probability, optimization and sampling library.
bool deprecate_fun(const std::string &old_name, const std::string &new_name, fun &f, std::ostream &msgs)
std::string get_prob_fun(const std::string &dist_name)
static function_signatures & instance()
void operator()(range &range, const expression &expr, bool &pass, std::stringstream &error_msgs) const
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
std::vector< expression > args_
validate_no_constraints_vis(std::stringstream &error_msgs)
void add(const std::string &name, const base_var_decl &base_decl, const var_origin &vo)
bool has_prob_fun_suffix(const std::string &name)
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
std::string get_cdf(const std::string &dist_name)
bool is_double_return(const std::string &function_name, const std::vector< expr_type > &arg_types, std::ostream &error_msgs)
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 exists(const std::string &name) const
std::vector< statement > bodies_
bool has_rng_suffix(const std::string &s)
bool is_primitive_int() const
bool validate_double_expr(const expression &expr, std::stringstream &error_msgs)
boost::phoenix::function< validate_int_expression > validate_int_expression_f
const int transformed_parameter_origin
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
base_var_decl get(const std::string &name) const
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
bool is_no_op_statement() const
boost::phoenix::function< subtraction_expr3 > subtraction3_f
boost::phoenix::function< addition_expr3 > addition3_f
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
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)
expression max_num_steps_
boost::phoenix::function< add_var > add_var_f
boost::phoenix::function< remove_lp_var > remove_lp_var_f
void set_type(const base_expr_type &base_type, size_t num_dims)
var_origin get_origin(const std::string &name) const
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
std::string get_ccdf(const std::string &dist_name)
boost::phoenix::function< set_double_range_lower > set_double_range_lower_f
boost::phoenix::function< validate_void_return_allowed > validate_void_return_allowed_f
const int function_argument_origin_lp
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
expr_type expression_type() const
bool contains(const std::set< std::string > &s, const std::string &x) const
void print_var_origin(std::ostream &o, const var_origin &vo)
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
bool is_nil(const expression &e)
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
void remove(const std::string &name)
const int void_function_argument_origin_rng
boost::phoenix::function< validate_int_expr > validate_int_expr_f
bool fun_name_exists(const std::string &name)
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
bool is_primitive() const
bool ends_with(const std::string &suffix, const std::string &s)
bool returns_type(const expr_type &return_type, const statement &statement, std::ostream &error_msgs)
boost::phoenix::function< add_expression_dimss > add_expression_dimss_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
boost::phoenix::function< validate_prob_fun > validate_prob_fun_f
boost::phoenix::function< add_line_number > add_line_number_f
bool is_defined(const std::string &name, const function_signature_t &sig)
boost::phoenix::function< validate_int_data_expr > validate_int_data_expr_f
bool is_ill_formed() const
std::vector< expression > args_
base_expr_type type() const
void operator()(const assgn &a, bool &pass, std::ostream &error_msgs) const
expr_type indexed_type(const expression &e, const std::vector< idx > &idxs)
Return the type of the expression indexed by the generalized index sequence.
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
const int void_function_argument_origin
boost::phoenix::function< set_omni_idx > set_omni_idx_f
void generate_expression(const expression &e, std::ostream &o)
base_expr_type base_type_
bool operator()(const nil &) const
size_t get_num_dims(const std::string &name) 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
bool has_non_param_var(const expression &e, const variable_map &var_map)
boost::phoenix::function< validate_allow_sample > validate_allow_sample_f
boost::phoenix::function< assign_lhs > assign_lhs_f
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
const int void_function_argument_origin_lp
base_expr_type base_type_
boost::phoenix::function< expression_as_statement > expression_as_statement_f
expr_type infer_type_indexing(const base_expr_type &expr_base_type, size_t num_expr_dims, size_t num_index_dims)
std::string integration_function_name_
boost::phoenix::function< validate_pmf_pdf_variate > validate_pmf_pdf_variate_f
std::vector< expression > conditions_
std::vector< arg_decl > arg_decls_
std::set< std::string > key_set() const
boost::phoenix::function< add_lp_var > add_lp_var_f
void operator()(const std::string &name, variable_map &vm) const
bool has_var(const expression &e, const variable_map &var_map)
boost::phoenix::function< elt_multiplication_expr > elt_multiplication_f
bool is_univariate(const expr_type &et)
void operator()(const expr_type &return_type, var_origin &origin, bool &pass, std::ostream &error_msgs) const
void operator()(variable_map &vm) const
std::vector< expression > dims_
bool has_ccdf_suffix(const std::string &name)
base_var_decl base_variable_declaration()
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
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
bool is_defined(const std::string &function_name, const std::vector< expr_type > &arg_types)
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::string strip_prob_fun_suffix(const std::string &dist_fun)
std::stringstream & error_msgs_
std::vector< expression > args_
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
std::ostream & write_base_expr_type(std::ostream &o, base_expr_type type)
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
void set_user_defined(const std::pair< std::string, function_signature_t > &name_sig)
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
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
bool is_primitive_double() const
boost::phoenix::function< add_fun_var > add_fun_var_f
void operator()(expression &expr1, const expression &expr2, std::ostream &error_msgs) const
std::vector< std::vector< expression > > dimss_
boost::phoenix::function< add_while_condition > add_while_condition_f
boost::phoenix::function< validate_assignment > validate_assignment_f
base_expr_type get_base_type(const std::string &name) const
bool deprecate_suffix(const std::string &deprecated_suffix, const std::string &replacement, fun &f, std::ostream &msgs)
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
const int transformed_data_origin
boost::phoenix::function< deprecate_old_assignment_op > deprecate_old_assignment_op_f
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