juniperfdel / pypyslalib

Fortran to Python transpiler experiement based on SLALIB and pyslalib
GNU General Public License v3.0
2 stars 0 forks source link

How to use on other Fortran code? #2

Open Beliavsky opened 2 years ago

Beliavsky commented 2 years ago

Thanks for your project. How can I use convert.py to convert other Fortran code I have, for example a file main.f containing

      integer function square(i)
      integer i
      square = i**2
      end

      program main
      integer i, isum, square
      isum = 0
      do i=1,3
         isum = isum + square(i)
      end do
      print*,"isum =",isum
      end
juniperfdel commented 2 years ago

Right now it is optimized for SLALib files, so the following changes would need to be implemented to the parser:

And following transforms:

Otherwise convert.py should be able to convert this code though I would need to double check to ensure square doesn't get mischaracterized as an array

juniperfdel commented 2 years ago

Additionally, it would need to allow for arbitrary file inputs as opposed to just looking for SLALib files