1 #ifndef STAN_LANG_AST_NODE_PROGRAM_HPP 2 #define STAN_LANG_AST_NODE_PROGRAM_HPP 3 4 #include <stan/lang/ast/node/function_decl_def.hpp> 5 #include <stan/lang/ast/node/statement.hpp> 6 #include <stan/lang/ast/node/block_var_decl.hpp> 7 #include <utility> 8 #include <vector> 9 10 11 namespace stan { 12 namespace lang { 13 14 /** 15 * AST node for a complete Stan program. 16 */ 17 struct program { 18 /** 19 * Type of a sequence of function declarations. 20 */ 21 typedef std::vector<function_decl_def> function_decls_t; 22 23 /** 24 * Type of a sequence of variable declarations. 25 */ 26 typedef std::vector<block_var_decl> block_var_decls_t; 27 28 /** 29 * Type of a sequence of statements. 30 */ 31 typedef std::vector<statement> statements_t; 32 33 /** 34 * Type of pair of variable declaration sequence and statement sequence. 35 */ 36 typedef std::pair<block_var_decls_t, statements_t> var_decls_statements_t; 37 38 /** 39 * Construct an uninitialized program. 40 */ 41 program(); 42 43 /** 44 * Construct a program with the specified components. 45 * 46 * @param[in] functions functions block 47 * @param[in] data data block 48 * @param[in] transformed_data transformed data block 49 * @param[in] parameters parameters block 50 * @param[in] transformed_parameters transformed parameters block 51 * @param[in] model model block 52 * @param[in] generated_quantities generated quantities block 53 */ 54 program(const function_decls_t& functions, 55 const block_var_decls_t& data, 56 const var_decls_statements_t& transformed_data, 57 const block_var_decls_t& parameters, 58 const var_decls_statements_t& transformed_parameters, 59 const statement& model, 60 const var_decls_statements_t& generated_quantities); 61 62 /** 63 * Functions block. 64 */ 65 std::vector<function_decl_def> function_decl_defs_; 66 67 /** 68 * Data block. 69 */ 70 std::vector<block_var_decl> data_decl_; 71 72 /** 73 * Transformed data block. 74 */ 75 std::pair<std::vector<block_var_decl>, std::vector<statement> > 76 derived_data_decl_; 77 78 /** 79 * Parameters block. 80 */ 81 std::vector<block_var_decl> parameter_decl_; 82 83 /** 84 * Transformed parameters block. 85 */ 86 std::pair<std::vector<block_var_decl>, 87 std::vector<statement> > derived_decl_; 88 89 /** 90 * Model block. 91 */ 92 statement statement_; 93 94 /** 95 * Generated quantities block. 96 */ 97 std::pair<std::vector<block_var_decl>, 98 std::vector<statement> > generated_decl_; 99 }; 100 101 } 102 } 103 #endif 104