Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Generating AST with ifort

MReza
Beginner
1,508 Views

Hello!

   I wonder if it is possible to generate abstract syntax tree (ast) files with ifort?

 

Many thanks

0 Kudos
3 Replies
mecej4
Honored Contributor III
1,442 Views

As far as I know, the answer is no. There is no requirement that a specific compiler use an AST or a similar representation in order to do its job.

After the transition to LLVM is complete, the IFX compiler may use an AST representation, but whether an ordinary user would be allowed to dump that AST is again questionable.

If it were available, what would you do with it?

0 Kudos
MReza
Beginner
1,409 Views

I would like to extract a component from a large Fortran application (i.e. a climate model). In a similar work (KGEN: A Python Tool for Automated Fortran Kernel Generation and Verification), I noticed they use AST information to collect the call graph of the component. AST can apparently help with data flow analysis as well. Without an AST, is there any alternative solution to collect such information (for example, call graph, global variables, shared variables, def-use information) from Intel Fortran compiler?

0 Kudos
Arjen_Markus
Honored Contributor I
1,432 Views

You could have a look at LFortran - it is a compiler under development, but currently quite capable of providing an AST. See https://gitlab.com/lfortran/lfortran

 

0 Kudos
Reply