Overview

Todo

add diagram

Syntax

We use RedBaron to parse the Python code. For headers, OpenMP and OpenAcc we use textX

In order to achieve syntax analysis, we first use RedBaron to get the FST (Full Syntax Tree), then we convert its nodes to our sympy AST. During this stage

  • variables are described as sympy Symbol objects

Note

a Symbol can be viewed as a variable with undefined type

In the semantic analysis process, we decorate our AST and

  • use type inference to get the type of every symbol
  • change Symbol objects to Variable when it is possible

Note

since our target language is Fortran, we only convert variables that have a type.

Full Syntax Tree (FST)

Abstract Syntax Tree (AST)