(Semi-)Compiled input decks #1336
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
This overhauls the entire parameter input machinery to rely on my input deck library Rummy. For examples of the new syntax, see the various input files in
examples/and the Rummy repository.Rummy breaks an input deck down into suits (the
<parthenon/...>nodes) and cards (the parameters themselves). The values of the cards are passed into a byte-code compiler that I wrote. The compiler supports strings, bools, and number variables and various operations on those variables. The syntax for the card values is similar to python. The three big things this adds is support for global variables, referencing other parameters defined in the input deck and full infix expressions. For example,Operators that are defined are
+, - ,*, /, ** (power), // (integer division), %, >, <, >=, <=, !, !=. You can add strings with+. Almost all of the<cmath>functions are supported. Vector params are supported and there is some limited support for slice operations. The compiled parts will spit out errors telling you what you did wrong.The syntax for variable reference is like classes. The
/in a node is replaced with a.. At this time, there is no inheritance.To support the new syntax I've changed a bit how the input arguments are handled. Now you can do things like this,
We accept multiple
-iinput files now. These are stuffed into a vector and compiled in order. The modifications are compiled after the input files and should now be wrapped in single quotes (if there are strings, otherwise double quotes is fine).Restarts are mostly the same, but I have added a
-Roption to read old restart files that use the old syntax.Another nice feature this adds is the ability for the host code to pre-populate parameters that can be used in the input files. For example, you could add all of the physical constants before the input decks are compiled.
Lastly, there is a simple
printfunction that can print the value of any parameter or expression from the input file.I anticipate the utility of this to grow with time as I work more on my compiler. Right now, branches and loops are supported in the compiler but not Rummy, and functions and classes are supported in neither, but I plan to work on those as time permits. The idea is to work towards a fully compiled and interpreted input file.
This is still WIP but appears to work for all the parthenon examples and various artemis tests, so I'm putting it up now for feedback. Things left to do include:
PR Checklist