Join GitHub today
Feature/2224 stan includes #2289
Add include mechanism to Stan language.
Allow includes with
Saves all the paths to report original file and line number and include history with error reports in both the parser and at run time.
Checks for circularity to avoid blowing out memory.
How to Verify
Upstream interfaces will need to specify a sequence of paths in which to find include files.
Yes. Manual and code.
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses:
@bob-carpenter, is there an easy way to generate a separate file with the include files?
It's ok if it requires a call to a second function.
From CmdStan, unless we know what the main
it would be a list of files like this:
with one relative path per file (the relative paths of the includes will be based on however they're found)? I can do that. It will require us to take another argument to the compiler and parser in the form of a
@syclik, could you confirm that's what you wanted?
@bob-carpenter, yes. If we had that, we could get the makefile in CmdStan to only build the executable when something in the list of files has changed. If not, we'd have to rebuild the executable every time just to be safe or have the user keep track on their own.
We don't need to do it for this pull request if it takes a bit of effort. I can create a new feature request.