stan-dev / stanc3

The Stan transpiler (from Stan to C++ and beyond).
BSD 3-Clause "New" or "Revised" License
142 stars 46 forks source link

Code gen reorganizing #1153

Closed WardBrian closed 2 years ago

WardBrian commented 2 years ago

As discussed in #1146, the function code generation has gotten really messy. This PR doesn't fix that, but it does move it into it's own file behind a very simple interface:

val pp_functions_functors : Format.formatter -> Program.Numbered.t -> unit
(** Pretty-print all user defined functions. Creates functor structs as needed
  *)

val pp_standalone_fun_def :
  string -> Format.formatter -> 'a Program.fun_def -> unit
(** Creates functions outside the model namespaces which only call the ones
   inside the namespaces *)

This PR changes no code, just where it is located. Hopefully it will make it easier for @SteveBronder or I to tackle the larger refactoring in the near future.

Submission Checklist

Release notes

Reorganize code gen modules

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 commented 2 years ago

@rok-cesnovar just as an FYI, this is fine if it gets merged before the patch, it's just cut/pasting code into different files for organizational reasons and doesn't need a release note.

rok-cesnovar commented 2 years ago

Merge away!