C to fortran converter

I wonder if ROSE can be adapted to translate C to Fortran.

Developed at Lawrence Livermore National Laboratory (LLNL), ROSE is an open source compiler infrastructure to build source-to-source program transformation and analysis tools for large-scale C (C89 and C98), C++ (C++98 and C++11), UPC, Fortran (77/95/2003), OpenMP, Java, Python and PHP applications.

I work with one of the ROSE developers. I put you in touch with her if you’re interested in using it and need more info.

Thanks a lot. You can contact me at hongyi.zhao@gmail.com.

I am trying to understand advanced features of Fortran.
Can I understand Fortran derived types as C structs and Fortran classes as C++ classes ?

Fortran derived types are like C++ classes…mostly. If you want a procedure to only accept a specific type as argument, specify that argument as type(thing). If you want it to also be able to accept any type which extends it, specify it as class(thing). If you want a variable to be polymorphic (i.e. at run time could be of type thing or anything that extends it), it has to be declared as class(thing), allocatable :: my_thing. There are some other nuances, but that’s the gist.

@everythingfunctional
Thank you. After learning OOP in c++ I am finding it a little difficult to comprehend in fortran. May be I should start afresh.

The fundamental concepts aren’t so different, but the terminology is different, and some of the semantics have nuanced differences. You’ll start to recognize things the more you study it.