Skip to content

Commit 9306813

Browse files
Merge pull request #845 from stan-dev/update-stanc-usage
Update page on stanc3 arguments
2 parents f71b7c7 + 5434fa3 commit 9306813

File tree

1 file changed

+31
-27
lines changed

1 file changed

+31
-27
lines changed

src/stan-users-guide/using-stanc.qmd

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -18,51 +18,52 @@ The stanc3 compiler has the following command-line syntax:
1818
```
1919
> stanc (options) <model_file>
2020
```
21-
where `<model_file>` is a path to either a Stan model
22-
file ending in suffix `.stan` _or_ a Stan functions
23-
file which ends in `.stanfunctions`.
21+
22+
where `<model_file>` is either a path to a file ending in
23+
`.stan` or `.stanfunctions` (which automatically sets
24+
`--standalone-functions`), or `'-'` to read from standard input.
2425

2526
The stanc3 options are:
2627

27-
- `--help` - Displays the complete list of stanc3 options, then exits.
28+
- `--help` / `-?` - Displays the complete list of stanc3 options, then exits.
2829

2930
- `--version` - Display stanc version number
3031

3132
- `--info` - Print information about the model, such
32-
as the type information for variables and the list of used distributions.
33+
as the type information for variables and the list of used distributions.
3334

3435
- `--name=<model_name>` - Specify the name of the class
35-
used for the implementation of the Stan model in the generated C++ code.
36-
37-
- `--o=<file_name>` - Specify a path to an output file for generated C++ code
38-
(default = <model_name>.hpp) or auto-formatting output (default: no file/print
39-
to stdout)
36+
used for the implementation of the Stan model in the generated C++ code.
4037

41-
- `--allow-undefined` - Do not throw a parser error if there is a function in
42-
the Stan program that is declared but not defined in the functions block.
43-
44-
- `--include_paths=<dir1,...dirN>` - Takes a comma-separated list
45-
of directories that may contain a file in an `#include` directive.
46-
47-
- `--use-opencl` - If set, will use additional Stan OpenCL
48-
features enabled in the Stan-to-C++ compiler.
38+
- `--o=<file_name>` / `-o=<filename>` / `--output=<filename>` - Specify a
39+
path to an output file for generated C++ code (default = <model_name>.hpp)
40+
or auto-formatting output (default: no file/print to stdout)
4941

5042
- `--auto-format` - Pretty prints the program to the console. See [more on auto
5143
formatting](#stanc-pretty-printing).
5244

45+
- `--allow-undefined` - Do not throw a parser error if there is a function in
46+
the Stan program that is declared but not defined in the functions block.
47+
5348
- `--canonicalize` - Make changes to the program before pretty-printing by
5449
specifying options in a comma separated list. Options are 'deprecations',
55-
'parentheses', 'braces', 'includes'.
50+
'parentheses', 'braces', 'includes', and 'strip-comments'.
51+
52+
- `--include_paths=<dir1,...dirN>` - Takes a comma-separated list
53+
of directories that may contain a file in an `#include` directive.
5654

5755
- `--max-line-length=<number>` - Set the column number at which formatting with
5856
`--auto-format` attempts to split lines. The default value is 78, which
5957
results in most lines being shorter than 80 characters.
6058

61-
- `--print-canonical` - Synonymous with `--auto-format --canonicalize=[all
62-
options]`.
59+
- `--print-canonical` - Synonymous with
60+
`--auto-format --canonicalize=deprecations,includes,parentheses,braces`.
6361

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

64+
- `--filename-in-msg=<name>` - Sets the filename used in compiler and runtime errors.
65+
If absent, the `<model_file>` argument is used.
66+
6667
- `--standalone-functions` - If set, only generate the code for the functions
6768
defined in the file. This is the default behavior for `.stanfunctions` files.
6869

@@ -74,16 +75,19 @@ used for the implementation of the Stan model in the generated C++ code.
7475
components are not thoroughly tested and may not improve a programs
7576
performance!_ Allow the compiler to apply all [optimizations](#optimization) to the Stan code.
7677

77-
- `--O` **WARNING:** _This is currently an experimental feature whose components
78-
are not thoroughly tested and may not improve a programs performance!_ Same as
79-
`--Oexperimental`. Allow the compiler to apply all [optimizations](#optimization) to the Stan
80-
code.
78+
- `--O` Synonym for `--O1` as of Stan 2.37. In earlier versions this was a synonym for
79+
`--Oexperimental`.
8180

82-
- `--warn-uninitialized` - Emit warnings about uninitialized variables
83-
to stderr. Currently an experimental feature.
81+
- `--use-opencl` - If set, will use additional Stan OpenCL
82+
features enabled in the Stan-to-C++ compiler.
8483

8584
- `--warn-pedantic` - Emit warnings in [Pedantic mode](#pedantic-mode)
8685
which warns of potential issues in the meaning of your program.
86+
Note: This may produce false positive warnings.
87+
88+
- `--warn-uninitialized` - Emit warnings about uninitialized variables
89+
to stderr. Currently an experimental feature.
90+
8791

8892
The compiler also provides a number of debug options which are
8993
primarily of interest to stanc3 developers; use the `--help`

0 commit comments

Comments
 (0)