33.1 Command-line options for stanc3

The stanc3 compiler has the following command-line syntax:

> stanc (options) <model_file>

where <model_file> is a path to a Stan model file ending in suffix .stan.

The stanc3 options are:

  • --help - Displays the complete list of stanc3 options, then exits.

  • --version - Display stanc version number

  • --info - Print information about the model, such as the type information for variables and the list of used distributions.

  • --name=<model_name> - Specify the name of the class used for the implementation of the Stan model in the generated C++ code.

  • --o=<file_name> - Specify the name of the file into which the generated C++ is written.

  • --allow-undefined - Do not throw a parser error if there is a function in the Stan program that is declared but not defined in the functions block.

  • --include_paths=<dir1,...dirN> - Takes a comma-separated list of directories that may contain a file in an #include directive.

  • --use-opencl - If set, will use additional Stan OpenCL features enabled in the Stan-to-C++ compiler.

  • --auto-format - Pretty prints the program to the console. See more on auto formatting.

  • --print-canonical - Similar to --auto-format, but program is also updated to remove deprecated features and canonicalize the program when possible.

  • --print-cpp - If set, output the generated C++ Stan model class to stdout.

  • --O - Allow the compiler to apply all optimizations to the Stan code. WARNING: This is currently an experimental feature!

  • --warn-uninitialized - Emit warnings about uninitialized variables to stderr. Currently an experimental feature.

  • --warn-pedantic - Emit warnings in Pedantic mode which warns of potential issues in the meaning of your program.

The compiler also provides a number of debug options which are primarily of interest to stanc3 developers; use the --help option to see the full set.