stan-dev / stan

Stan development repository. The master branch contains the current release. The develop branch contains the latest stable development. See the Developer Process Wiki for details.
https://mc-stan.org
BSD 3-Clause "New" or "Revised" License
2.57k stars 368 forks source link

tuples: parse json to var_context #3161

Closed mitzimorris closed 1 year ago

mitzimorris commented 1 year ago

Summary:

Extend existing stan::json::json_data class to generate/populate the maps vals_r and vals_i.

Description:

With the addition of tuples to the Stan language, users will be able to declare structured variables (data and parameters) containing any combination of tuples and arrays including tuples of tuples, array of tuples, and tuples of arrays, etc. See https://github.com/stan-dev/design-docs/pull/46

The stanc3 compiler branch tuple-redo can generate the C++ code which calls the var_context functions vals_r and vals_i. What is missing is the capability on the stan::json::json_data class (stan/io/json/json_data_handler.hpp) to parse the JSON file into the corresponding var_context object, populating maps vals_r and vals_i.

Demonstrate completeness via round-trip tests for all examples of tuples given in the tuples design-doc: https://github.com/stan-dev/design-docs/pull/46

Reproducible Steps:

Demonstrate completeness via round-trip tests for all examples of tuples given in the tuples design-doc: https://github.com/stan-dev/design-docs/pull/46

Current Output:

N/A

Expected Output:

see tuples spec.

Additional Information:

Not extending dump format.

Current Version:

v2.31.0