Pragmas
Each pragma will be stored as a string in a PragmaNodeIF. These strings will be translated to other AST nodes by an ASTTransformerIF called the PragmaParser. The PragmaParser is called as the first stage in the model building process. It traverses the AST, checks to see whether or not each pragma is a TASS pragma, and parses the strings for each TASS pragma. The strings are parsed based on an ANTLR grammar.
PragmaNodeIF has a field that is a reference to the next AST node. This field is for convenience when dealing with pragmas that refer to the following statement (input, output, collective invariant, etc.).
#define
In TASS it is possible for C preprocessor object-like macros to be tagged as inputs. This looks something like:
#pragma TASS input {N > 0} int
#define N 10
Once the preprocessor has been run, the #define no longer appears in the code. Thus the front end must make an initial pass that copies just the variable name to the end of the input pragma line whenever this form is encountered. After this pass, the above example becomes:
#pragma TASS input {N > 0} int N
#define N 10
Note that nothing in the code changes aside from the TASS pragma.
The workflow for code with pragmas is as follows.
Preprocess input #define macros -> Clang to XML -> XML to AST -> PragmaParser -> Build model -> Run TASS on model.
