Stan  2.5.0
probability, sampling & optimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
compiler.hpp
Go to the documentation of this file.
1 #ifndef STAN__GM__COMPILER_HPP
2 #define STAN__GM__COMPILER_HPP
3 
4 #include <stan/gm/ast.hpp>
5 #include <stan/gm/generator.hpp>
6 #include <stan/gm/parser.hpp>
7 
8 #include <iostream>
9 #include <string>
10 
11 namespace stan {
12 
13  namespace gm {
14 
37  bool compile(std::ostream* msgs, // for warnings
38  std::istream& stan_gm_in,
39  std::ostream& cpp_out,
40  const std::string& model_name,
41  const std::string& in_file_name = "input") {
42  program prog;
43  bool parsed_ok = parse(msgs,stan_gm_in,in_file_name,model_name,prog);
44  if (!parsed_ok)
45  return false; // syntax error in program
46  generate_cpp(prog,model_name,cpp_out);
47  return true;
48  }
49 
50 
51  }
52 
53 }
54 
55 #endif
bool parse(std::ostream *output_stream, std::istream &input, const std::string &filename, const std::string &model_name, program &result)
Definition: parser.hpp:61
void generate_cpp(const program &prog, const std::string &model_name, std::ostream &out)
Definition: generator.hpp:4614
bool compile(std::ostream *msgs, std::istream &stan_gm_in, std::ostream &cpp_out, const std::string &model_name, const std::string &in_file_name="input")
Read a Stan model specification from the specified input, parse it, and write the C++ code for it to ...
Definition: compiler.hpp:37

     [ Stan Home Page ] © 2011–2014, Stan Development Team.