stanc3 icon indicating copy to clipboard operation
stanc3 copied to clipboard

Add support for `@annotations`

Open WardBrian opened this issue 1 year ago • 3 comments

Initial implementation of https://github.com/stan-dev/design-docs/blob/master/designs/0033-declaration-annotations.md:

  • Basic parsing of @annotations on declaration nodes, propagation of this information throughout compiler.
  • Implementation of @extern example from the design doc, can be placed on functions to silence the declared-but-undefined typechecking error function-by-function
  • Implementation of @silent, which allows a parameter which is not output by write_array. Particularly useful for custom transforms with jacobian+= where the "raw" form is not desired. Note: This feature does lead to models which prohibit certain features like standalone generated quantities.

Submission Checklist

  • [x] Run unit tests
  • Documentation
    • [ ] If a user-facing facing change was made, the documentation PR is here: <LINK>

Release notes

@extern can now be placed before a function declaration to mark it as defined in an external C++ file @silent can be placed on a variable in one of the output blocks (e.g. parameters) to prevent it from appearing in the CSV output.

Copyright and Licensing

By submitting this pull request, the copyright holder is agreeing to license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)

WardBrian avatar Jul 15 '24 19:07 WardBrian