| | 1 | = CIVL: Fortran Front End Overview = |
| | 2 | |
| | 3 | == 1. Goals == |
| | 4 | `FortranFrontEnd` is a `CIVL` component generating CIVL abstract syntax trees (`CIVL IR`) |
| | 5 | from given `FORTRAN` source files so that `CIVL` can verify desired correctness properties |
| | 6 | for `FORTRAN` programs based on their `CIVL IR`. |
| | 7 | |
| | 8 | Considering that: |
| | 9 | 1). most concurrent APIs (e.g., `MPI`, `OpenMP`, etc.) support bindings of |
| | 10 | both `C` and `FORTRAN`; |
| | 11 | |
| | 12 | 2). `FORTRAN` source code are commonly pre-processed by a general preprocessor; |
| | 13 | |
| | 14 | 3). `CIVL` is originally designed and developed for verifying `C` programs; |
| | 15 | |
| | 16 | `FORTRAN` source files will be firstly pre-processed by `CIVL`'s general preprocessor; |
| | 17 | and then a preprocessed token stream will be converted to a `FORTRAN` token stream; |
| | 18 | an `ANTLR` generated parser will process it based on `FORTRAN 2018` standard; |
| | 19 | finally, the parse tree will be transformed to `CIVL IR`. |
| | 20 | |
| | 21 | === 1.1 Base === |
| | 22 | ==== Accomplished ==== |
| | 23 | * Support pre-processing `FORTRAN` source with a general pre-processor [https://vsl.cis.udel.edu/lib/sw/civl/ directives]; |
| | 24 | |
| | 25 | ==== In-progress ==== |
| | 26 | * Support parsing a frequently used subset of Fortran `FORTRAN 2018` standard; |
| | 27 | * Support interpreting supported `FORTRAN` behaviors by `CIVL IR`; |
| | 28 | * Support parsing a frequently used subset of `OpenMP` `FORTRAN` bindings; |
| | 29 | * Support interpreting supported `OpenMP` `FORTRAN` bindings by `CIVL IR`; |
| | 30 | |
| | 31 | ==== TODO list ==== |
| | 32 | * Support `OpenMP` `SIMD` directives; |
| | 33 | * Support `CIVL` primitives in `FORTRAN` code; |
| | 34 | |
| | 35 | === 1.2 RAPIDS === |
| | 36 | |
| | 37 | ==== In-progress ==== |
| | 38 | * Support verifying the functional equivalence for `FLASH5` project |
| | 39 | (between the original version and optimized transformation); |
| | 40 | |
| | 41 | == 2. Design == |
| | 42 | |
| | 43 | === A general preprocessor === |
| | 44 | * Input: A set of `FORTRAN` source files |
| | 45 | * Output: A set of preprocessor (PP) token streams. |
| | 46 | * Functionality: |
| | 47 | * Macro operations |
| | 48 | * Conditional compilation |
| | 49 | * File inclusion |
| | 50 | |
| | 51 | === A PP-to-FORTRAN convertor === |
| | 52 | * Input: A PP-token stream |
| | 53 | * Output: A `FORTRAN` token stream |
| | 54 | * Functionality: |
| | 55 | * Token conversion (from PP-token vocabulary to `FORTRAN` token one) |
| | 56 | * Comments/whitespaces/newline filtration |
| | 57 | * `INCLUDE` statement replacement |
| | 58 | * Keyword identification (a lexical pre-pass procedure) |
| | 59 | |
| | 60 | === An ANTLR generated parser === |
| | 61 | * Input: A `FORTRAN` token stream |
| | 62 | * Output: A `FORTRAN` parse tree |
| | 63 | * Functionality: |
| | 64 | * Parse tree generation |
| | 65 | * Syntax error report. |
| | 66 | |
| | 67 | === A parse tree trasformer === |
| | 68 | * Input: A `FORTRAN` parse tree |
| | 69 | * Output: A `CIVL IR` interpreting the semantics of given `FORTRAN` source files. |
| | 70 | * Functionality: |
| | 71 | * Abstract syntax tree transformation (from a parse tree to `CIVL IR`) |
| | 72 | * Variable/expression type analysis required for the transformation |
| | 73 | |