This is not literally the Stan Language definition, which is in the Stan Modeling Language User's Guide and Reference Manual.
This repo contains stan-lang.json, which contains various keywords and built-in functions in Stan that I use in maintaining several editor modes and syntax highlighting defintions.
In particular, this is used to generate the keyword and function lists in:
- Emacs stan-mode (Current maintainer: @kaz-yos).
- Atom language-stan.
- Pygments StanLexer.
- LaTeX package lstbayes (github).
make all in this directory invokes the create_stan_lang.py Python script. This script parses the following manually maintained files to construct the stan-lang.json file. make clean will delete this file.
stan-lang-keywords.yamlstan-functions-*.txt
The stan-functions-*.txt file is generated by the extract_function_sigs.py script in the stan docs repo. For example, function signatures for Stan version 2.4.x can be generated as follows after cloning the stan-dev/docs repo.
git clone git@github.com:stan-dev/docs.git
cd docs
python3 extract_function_sigs.py
Copy the resulting file named stan-functions-2_24.txt to this repo.
- Update functions to latest and parse new
array [] intsyntax as replacement forint[]syntax - Add
.^and%/%operators - Add support for the
complextype
- Explain function signature file generation using the extract_function_sigs.py script
- Add
offsetandmultiplierto keywords.
- Links have been updated
- data only arguments in functions such as ODE functions are handled as special cases in the Python parsing script.
=now used for assignment.<-is deprecated.- New
targetkeyword fortarget += expression - Variable
lp__is no longer supported - Indicate
log_prob()andtarget()as special functions - Ternary operator
a ? b : c - New ODE integrate keywords:
integrate_ode,integrate_ode_rk45,integrate_ode_bdfwhich support 6 or 9 arguments. - Deprecate functions:
log_prob,increment_log_prob,binomial_log,multiply_log y ~ foo(a, b)is deprecated in favor oftarget += foo(y | a, b)- Distribution postfixes
_log,_cdf_log, and_ccdf_logdeprecated in favor of_lpdf,_lpmf,_lcdf,_lccdf,_cdf,_ccdf.