Dear LFortran users and experts,
I am new to LFortran. I think LFortran is an amazing project that could allow me to translate (the core part of) VASP into Julia. To do this, I need to do some experimental projects, starting with a single Fortran file from the VASP source code. However, most of the source files contains
#include lines, which import definitions, macros from other files.
My question is, if I just wish to focus on a single Fortran file and want to use
lfortran --show-ast FORTRAN_SRC.F
to produce the AST and then feed that into the Julia AST processor, how can I instruct LFortran to properly include all necessary files? Currently I got an error message
(base) a@a:~/a/src$ lfortran --show-ast dmft.F syntax error: Token 'GDEF' (of type 'identifier') is unexpected here --> dmft.F:37:3 | 37 | GDEF, ALLOCATABLE :: TWOE_4WANNIER(:,:,:,:,:,:,:) | ^^^^ Note: if any of the above error or warning messages are not clear or are lacking context please report it to us (we consider that a bug that must be fixed).
where the file dmft.F contains a line
(base) a@a:~/a/src$ cat dmft.F | grep "GDEF, ALLOCATABLE :: TWOE_4WANNIER" -C3 ! REAL(q),ALLOCATABLE :: WPOS(:,:) ! two electron four orbital integrals in a Wannier basis GDEF, ALLOCATABLE :: TWOE_4WANNIER(:,:,:,:,:,:,:) ! some parameter from ADD_XI routine, needed for PIJKL REAL(q), PARAMETER :: PIJKL_EMPTY_THRESHHOLD=0.00001
and I know that the first line in
(base) a@a:~/a/src$ head dmft.F #include "symbol.inc" MODULE dmft ...
and the file “symbol.inc” is a collection of macros, where I find
(base) a@a:~/a/src$ cat symbol.inc | grep "GDEF " #define GDEF REAL(q) #define GDEF COMPLEX(q)
In this particular case, how can I instruct LFortran to properly include
"symbol.inc" when building the AST/ASR for the file
In general, how can I do this cleanly for each file in the source file folder?