Stan  1.0
probability, sampling & optimization
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 
31  bool compile(std::ostream* output_stream, // for warnings
32  std::istream& stan_gm_in,
33  std::ostream& cpp_out,
34  const std::string& model_name,
35  bool include_main = true,
36  const std::string& in_file_name = "input") {
37  program prog;
38  bool parsed_ok = parse(output_stream,stan_gm_in,in_file_name,prog);
39  if (!parsed_ok)
40  return false; // syntax error in program
41  generate_cpp(prog,model_name,cpp_out,include_main);
42  return true;
43  }
44 
45 
46  }
47 
48 }
49 
50 #endif
void generate_cpp(const program &prog, const std::string &model_name, std::ostream &out, bool include_main=true)
Definition: generator.hpp:3095
bool compile(std::ostream *output_stream, std::istream &stan_gm_in, std::ostream &cpp_out, const std::string &model_name, bool include_main=true, const std::string &in_file_name="input")
Read a Stan directed graphical model specification from the specified input, parse it,...
Definition: compiler.hpp:31
bool parse(std::ostream *output_stream, std::istream &input, const std::string &filename, program &result)
Definition: parser.hpp:62
Probability, optimization and sampling library.
Definition: agrad.cpp:6

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