-
Notifications
You must be signed in to change notification settings - Fork 0
fpp to json
This tool parses an FPP model, performs semantic checking on it, and writes out the model in JavaScript Object Notation (JSON) format.
Options:
-
-ddir: Set the output directory to dir. If this option is not present, then the output directory is the current directory. -
-s: Emit syntax only (location map and abstract syntax tree).
Input:
-
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:
-
A file
fpp-ast.jsoncontaining a JSON representation of the abstract syntax tree (AST). -
A file
fpp-loc.jsoncontaining a JSON representation of the location map. -
If the flag
-sis not present, then a filefpp-analysis.jsoncontaining a JSON representation of the Analysis Data Structure.
Procedure:
-
Parse each of the files in fl, generating a list tul of translation units. When parsing, recursively resolve include specifiers.
-
Convert the abstract syntax tree (AST) and the location map to JSON objects.
-
If
-sis not present, then-
Perform semantic checking on tul.
-
Convert the Analysis Data Structure to a JSON object.
-
-
Write the JSON objects to files.
JSON AST Parser
The fpp-ast.json output from this tool can be quite tedious to parse, but is a very useful source for programatically interpreting the fpp model files. As such, a barebones Python-based JSON AST parser is provided as a utility of [fprime-tools](https://github.com/nasa/fprime-tools/pull/207), as well as an fpp syntax writer.
Examples for utilizing both tools are provided in the fprime-tools utility folder.