Skip to content

fpp to json

Robert L. Bocchino Jr. edited this page Apr 18, 2024 · 11 revisions

This tool parses an FPP model, performs semantic checking on it, and writes out the model in JavaScript Object Notation (JSON) format.

Options:

  1. -d dir: Set the output directory to dir. If this option is not present, then the output directory is the current directory.

  2. -s: Emit syntax only (location map and abstract syntax tree).

Input:

  1. A list fl of files to translate: either the single file stdin or a list of files specified on the command line.

Output:

Fpp-to-json generates the following files:

  1. A file fpp-ast.json containing a JSON representation of the abstract syntax tree (AST).

  2. A file fpp-loc.json containing a JSON representation of the location map.

  3. If the flag -s is not present, then a file fpp-analysis.json containing a JSON representation of the Analysis Data Structure.

Procedure:

  1. Parse each of the files in fl, generating a list tul of translation units. When parsing, recursively resolve include specifiers.

  2. Convert the abstract syntax tree (AST) and the location map to JSON objects.

  3. If -s is not present, then

    1. Perform semantic checking on tul.

    2. Convert the Analysis Data Structure to a JSON object.

  4. Write the JSON objects to files.