Posts

GSOC 2022 - LFortran - Implementing Generics

          GSOC 2022 - LFortran - Implementing Generics Final report - Oshanath Rajawasam Mentors : Ondřej Čertík, Gagandeep Singh Overview This project was about implementing generics for LFortran. This project was implemented parallelly to the same project on LPython, so a lot of the same code is reused. The LPython counterpart was developed by Luthfan Lubis and it has progressed further than this project. Reason for the Project Functions and subroutines in Fortran have specific parameter types and return types associated with them. Since LFortran, at its core, is the same as Fortran, this is also the case for LFortran. This can be problematic when the application demands template-like structures. For example, when implementing a function to add 2 numbers, with current tools available, we would have to implement the same function for all data types it is intended to be used. But with templates, we can define the function once, and use it with any data type we wish. The solution in a n
          2022-09-09-progress report 13 This week I did not get any work done due to exams held at my university.
         2022-09-02-progress report 12 This week I did not get any work done due to exams held at my university.
        2022-08-26-progress report 11 This week I did not get any work done due to exams held at my university.
       2022-08-19-progress report 10 This week I converted my PR  Merging function and TemplatedFunction by Oshanath · Pull Request #90 · lfortran/lfortran (github.com)  into a mergeable state by cleaning the history and updating the reference tests to reflect the changes to ASR and AST with instantiation. Then the PR was merged.
      2022-08-13-progress report 9 This week I worked on the ASR of the template instantiation. The work is featured in  this Pull Request. I used the code from last week (from LPython) and tailored it to suit LFrotran. Now in the AST body visitor, if there is a TypeParameter in the statements, it will add a TypeParameter.  Then in the instantiation, it maps the TypeParameters with the types. I refactored some existing code of LFortran. The piece of code where the variable type is detemined, I also have to use it for determining the type from user's instantiation syntax. The current implementation supports multiple TypeParameters per Template as well as multiple instances of the same Template using different types.
     2022-08-06-progress report 8 This week I worked on the template instantiation syntax for the parser. It's posted in  this pull request . It features a basic syntax for now. Then I rebased all my work on Ondrej's PRs to merge Function and Subroutine as well PR to implement ASR level templates based on Luthfan's work.