Check Interface Definitions - nasa/fpp GitHub Wiki

This algorithm traverses the source model and checks interface definitions.

Input

  1. A list tul of translation units.

  2. An analysis data structure a representing the results of analysis so far.

Output

An updated analysis a' with the interface map filled in if the check passes; otherwise an error.

Procedure

Visit each translation unit in tul with input a, yielding either a' or an error.

AST Visitor Methods

Each method accepts an analysis data structure a as input and yields either an updated analysis data structure a' or an error as output.

Translation Units

For each translation unit tu, visit each interface definition definition appearing in tu.

Interface Definitions

For each interface definition d

  1. Create a new interface i.

  2. Visit each member m of d with input a.

    1. If m is a interface import specifier

      1. Look up the interface definition i associated with m. If the interface does not exist, throw an error.

      2. Check Interface definitions for i and update a.

      3. Visit each port instance member p of i.

        1. Apply the same rules to p as are applied to interface definition port instance specifiers.

    2. If m is a port instance specifier, then

      1. Check that the specifier follows the rules. For example, async specifiers may not use ports with ref parameters; specifiers that are not async may not specify queue behavior.

      2. Create a new port instance pi

      3. Add pi to the port instance map of c. If the name is already in the map, then throw an error.

      4. If m is a special port instance specifier, then

        1. Add pi to the special port instance map of c.

        2. If the kind is already in the map, then throw an error.

  3. Construct the unique interface symbol s for d.

  4. Map s to c in the interface map of a.

  5. Return a as the result.

⚠️ **GitHub.com Fallback** ⚠️