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 w...
2022-07-22-progress report 6 I wrote code to generate ASR from AST this week. It is an initial implementation so it's not complete. I had to make some changes to the example "swap_m.f90" since I couldn't get the interface working. I will work on it in a future week. The general approach I took is I added a symbol table to the Template since it will contain functions and subroutines (program units) as well as derived types. I also ignored restrictions and TypeParameter for now. The first item of the Short term TODO list of this PR is now complete.
2022-07-29-progress report 7 I enhanced the ASR generation from last week. Now ASR have both "TemplatedFunctions" as well as "TemplatedSubroutines". The TypeParameters of Templates are now populated. Visiting Function in the symbol_table_visitor now results in either Functions, if there are no TypeParameters used, or TemplatedFunctions if one, some or all TypeParameters of the surrounding Template are used. The TypeParameters of TemplatedFunctions and TemplatedSubroutines are also populated with only the TypeParameters that those functions and subroutines use. I met with Ondrej and he created this pull request that is a combination of my first two PRs, which contain ASR generation. Then I rebased the 3rd PR on top of the one Ondrej created. Finally I started working on instantiation of templated. Particularly the parsing and AST generation of instantiation. I read through this document to get an idea of required syntax for templates. The actua...
Comments
Post a Comment