Changes between Initial Version and Version 1 of Pragmas


Ignore:
Timestamp:
07/28/11 02:33:39 (15 years ago)
Author:
zirkel
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Pragmas

    v1 v1  
     1= Pragmas =
     2
     3Each 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.
     4
     5PragmaNodeIF 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.).
     6
     7== #define ==
     8
     9In TASS it is possible for C preprocessor object-like macros to be tagged as inputs.  This looks something like:
     10
     11{{{
     12#pragma TASS input {N > 0} int
     13#define N 10
     14}}}
     15
     16Once 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:
     17
     18{{{
     19#pragma TASS input {N > 0} int N
     20#define N 10
     21}}}
     22
     23Note that nothing in the code changes aside from the TASS pragma.
     24
     25The workflow for code with pragmas is as follows.
     26
     27Preprocess input {{{#define}}} macros -> Clang to XML -> XML to AST -> !PragmaParser -> Build model -> Run TASS on model.