LFortran is participating in GSoC 2021 under the NumFOCUS and Fortran-lang organizations.
Below we list developed project ideas listed by priority. The "High Priority" section contains projects that we are especially interested in, as they lie on the critical path to a minimal viable product: make LFortran usable for simpler projects.
However, feel free to propose any project idea that you like to improve LFortran, for example by browsing open issues:
https://gitlab.com/lfortran/lfortran/-/issues
If you are interested in applying, please get in touch with us at either our Zulip chat or our mailinglist:
We will help answer questions and help with finding and refining a project idea. You do not need to have a prior experience with compilers, we will teach you. It is fun. LFortran is written in C++, but we do not use many advanced features and if you have programming experience you will be able to pick it up.
Here are a few projects for inspiration. You are welcome to propose your own idea.
If you want to apply, here is a check list / student instructions:
GSoC 2021 Student Instructions
High Priority
Finish AST generation
LFortran has a Bison based parser implemented in the parser.yy file that can parse most of Fortran. Not all the grammar rules there are converted to AST yet. The purpose of this project would be to systematically go over the parser.yy
file and ensure AST is always generated for all grammar rules. AST.asdl contains a list of AST nodes. You can read the comment there that explains the background and design motivation behind AST. The AST nodes are constructed from the grammar actions (specified between the { ... }
in parser.yy
) using macros that are defined in the semantics.h file.
The project would add all missing AST nodes into AST.asdl
, add macros to semantics.h
and use them in parser.yy
.
If you have any questions, please do not hesitate to ask, we can discuss or provide more details.
Mentors: Ondrej Certik (@certik)
Implementation of features on the ASR and LLVM level
The roadmap #272 issue contains a list of Fortran features that we want implemented. Each feature should be implemented at the ASR level and in the LLVM backend to be complete. If AST is missing for a given feature, then it has to be implemented also.
Here you can pick a feature or a set of features from the list and propose it as a GSoC project. In other words, this project idea can accommodate multiple student projects.
List of resources for more information and background:
- ASR.asdl, the comment at the top explains the design motivation
- asr_to_llvm.cpp is the LLVM backend
- ast_to_asr.cpp is the AST -> ASR conversion where all semantics checks are being done and compiler errors reported to the user
- Developer Tutorial
If you have any questions, please do not hesitate to ask, we can discuss or provide more details.
Mentors: Ondrej Certik (@certik)
Medium Priority
Improve x86 code generation
LFortran has a very fast x86 code generation backend implemented in asr_to_x86.cpp which allows very fast compiling (many times faster than going via LLVM). The x86 backend does not do any optimizations, so it is meant to be used in Debug mode only. As every backend in LFortran, the backend receives the code as ASR, and it recursively walks over each ASR node and generates x86 machine code.
The purpose of this project would be to extend this backend to cover more Fortran features.
If you have any questions, please do not hesitate to ask, we can discuss or provide more details.
Mentors: Ondrej Certik (@certik)
Low Priority
Automatic Fortran to Python wrapping
Add a backend to LFortran that automatically exposes (eventually all) Fortran module contents to Python. Similar to how f2py works, but using a robust production level parser and semantic analysis from LFortran.
Related issues:
- lfortran#133: Automatic wrappers Fortran -> Python
Mentors: Ondrej Certik (@certik),
Finish the automatic formatter (lfortran fmt)
Here is a list of issues that should be fixed in order to make automatic formatting via lfortran fmt
more useful: %Format `fpm`. This project could work on fixing those and implement other improvements in order for lfortran fmt
to work on some projects such as stdlib
.
Mentors: Ondrej Certik (@certik),
Allow to use gfortran compiled module files
There is a prototype parser for gfortran module files here: https://gitlab.com/lfortran/lfortran.py/-/blob/7a3b356122174d291562a5c47f0d2c9dc3b183da/lfortran/adapters/gfortran/mod.py. Port it to C++ and the current LFortran, and then allow such modules to be "used" in LFortran.
Related issues:
- lfortran#52: Allow to "use" modules compiled by gfortran
Mentors: Ondrej Certik (@certik),
Roundtrip Parser
Modify one of the following Fortran parsers as a roundtrip parser, which can recreate the original source code by fully capturing formatting data (case-sensitive variable names, whitespace, comments, etc.) alongside the syntactically essential content. The goal would be to develop code that both LFortran and Flint could use.
Mentors: Ondrej Certik (@certik), Marshall Ward (@marshallward)