stan-dev/stan — pull request #621 by bob-carpenter (2014-04-13 20:39:34+00:00)
Title: Feature/issue 597 function lang

#### Summary:

Adds user-defined functions to Stan (issue #597 ) and fixes grammar for range constraints (issue #422 ).

#### Intended Effect:

Allow users to define their own functions, including ones that access log prob, act as densities, and act as random number generators.

Also fixed grammar along the way to allow more general expressions in range constraints for real, int, vector, row-vector and matrix.

#### How to Verify:

Run the unit tests. Try some functions. There are examples linked from `gm/parser_test.cpp` and more in `test-models/syntax-only/funs*.stan`. The additions to the abstract syntax tree are independently tested.

I also tested on the side (not in committed code, because I don't know how to do it), that the models with functions in `syntax-only` had the correct behavior.

#### Side Effects:

None.

#### Documentation:

There are new chapters in the programming guide part and in the language reference part; the latter is the final spec.

There are examples for everything. All model fragments in the doc were tested for compilation.

The doc already reflected the way the range constraints were supposed to work.

#### Reviewer Suggestions:

Anyone with a lot of time on their hands --- this is a big one.