ROSE  0.9.9.139
Description of AST Diagnostics within ROSE

This page specifies what mechanisms we provide to test the AST. More details are at AstDiagnosticsClasses. Analysis of the AST is separated into consistency tests, warnings about questionable AST configurations, and statistical properties of the AST.

  1. Consistency tests are pass/fail and all are requred to pass to verify correctness of the AST.
  2. Warnings represent the detection of patterns of IR nodes which are not presently disallowed, but which might be problematic. Likely they will work for the unparser to generate code, but are incorrect in ways that would lead to incorrect analysis. In general the unparser will generate good code from an AST which can still contain errors (e.g the unparse does not require that the symbols in the symbol table be correct, but many forms of program analysis might use this information).
  3. Statistical properties of the AST report on a number of issues relavant to debugging the AST (testing coverage, etc.).

AST Consistency Tests

Current tests are pass/fail and test the following properties:

  1. parent pointers are verified correct
  2. file info objects are verified to be correct, none are set to default values (filename="NULL_FILE",line number =0, column number = 0) except for compiler generated IR nodes.
  3. pointers to file info objects are verified to be valid pointers
  4. all file info objects are verified to be unique (non-shared)
  5. the type of a SgFunctionRefExp is always a SgFunctionType.
  6. ...

Future Consistency Tests

 There are a number of tests planned for the near future:
 -# SgInitializedName diagnostics
 -# correct configuration of SgExpressionRoot (SgReturnStmt)
 -# Complete list in ROSE/proposals/TODO.txt

AST Warnings

 There are a number of warnings that are output if certain parterns of IR usage are
found:
 -# Uniquness of file info objects in AST.

Future Warnings

 A number of warnings are planed for the near future:
 -# correct usage of SgInitializedName
 -# etc. (see list in TODO.txt).

AST Statistical Properties

The AST has about 240 IR nodes and so this section is focuced on the statistical useage of IR nodes within the AST. Current statistical properties of the AST supported are:

  1. percentage of use of each IR node in the AST.

Future Statistical Properties

It is easy to imagin additional ASt properties to report. Future work will implement a numbe of tests useful for debugging the AST:

  1. percentage of AST that passes all tests.
  2. percentage of AST which generates warnings.