GSoC 2022 Ideas - lcompilers/lpython GitHub Wiki

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 LPython usable for simpler projects.

However, feel free to propose any project idea that you like to improve LPython, for example by browsing open issues:

https://github.com/lcompilers/lpython/issues

If you are interested in applying, please get in touch with us at either our Zulip chat or our mailing list:

We will help answer questions and help with finding and refining a project idea. You do not need to have prior experience with compilers, we will teach you. It is fun. LPython is written in C++, but we do not use many advanced features and if you have any programming experience you will be able to pick it up.

Here are a few projects for inspiration, they contain a mix of well-developed ideas and less developed ideas. You are welcome to propose your own idea as well.

Patch Requirement

We have a patch requirement in order to consider your application. Please send a patch (Pull Request) to LPython that has to be merged by the time the application period closes (April 19). You can fix or improve anything you like. If you have any questions, please contact us (for example on Zulip) and we will help.

Mentors

Potential mentors:

  • Ondřej Čertík
  • Gagandeep Singh
  • Rohit Goswami
  • Thirumalai Shaktivel
  • Naman Gera
  • Smit Lunagariya

High Priority

Very fast parser to AST

Right now we use the CPython itself to do the parsing to CPython AST, then we convert to LPython AST from Python: https://github.com/lcompilers/lpython/blob/f81caecd9897ac38cc6c08eb8ca22793cbb1dddc/src/runtime/lpython_parser.py, serialize to a file, and deserialize from C++. That is a slow process. In order to get as fast a parser as possible, we need to parse from C++ and generate the AST nodes directly. To do that, we should explore whether the CPython parser (implemented in C) could be used. If not, we should write our own parser using re2c and Bison.

Expected outcomes: LPython can parse any Python code to AST using its own very fast parser.

Skills preferred: Python and C++ programming

Difficulty: intermediate, 350 hours

Mentors - Ondřej Čertík, Thirumalai Shaktivel

Implement Generics

Currently LPython requires all arguments to functions to be typed. In this project, we will extend LPython to be able to compile functions where argument types are templates (generic programming). The untyped function becomes a generic function, and then when it is used with concrete types, the template gets instantiated at compile-time, ahead of time.

Expected outcomes: LPython can compile untyped code using generics.

Skills preferred: Python and C++ programming

Difficulty: intermediate, 350 hours

Mentors - Ondřej Čertík, Rohit Goswami, Gagandeep Singh

Implementation of features on the ASR and LLVM level

The roadmap https://github.com/lcompilers/lpython/issues/155 issue contains a list of Python 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:

If you have any questions, please do not hesitate to ask, we can discuss or provide more details.

Difficulty: easy/intermediate (depending on the task), can be 175 hours or 350 hours

Mentors: Ondrej Certik (@certik), Gagandeep Singh

Allow running LPython in the browser

This project would entail working with LPython, LLVM, Emscripten, and Webassembly to allow running LPython in the browser.

  • use LLVM and Emscripten to compile LPython code to Webassembly
  • create custom Webassembly backend for LPython and compile LPython itself to Webassembly

Relevant issues:

Expected outcomes: LPython can compile Python code, as well as bootstrap itself, to Weabassembly.

Skills preferred: Python and C++ programming

Difficulty: intermediate, 350 hours

Mentors - Ondřej Čertík, Rohit Goswami

Language Server

This project would be used to first serialize the ASR and then use it within a language server.

Expected outcomes: LPython can be used as a Python language server that can be used in other software such as source code editors and IDEs.

Skills preferred: Python and C++ programming

Difficulty: intermediate, 350 hours

Mentors: Ondřej Čertík (@certik), Smit Lunagariya

Implement modules from the Python standard library

The Python standard library has a lot of modules: https://docs.python.org/3/library/index.html.

The project includes discussing which modules will be needed for LPython (from a scientific computing perspective, in the beginning), creating a priority list, and then implementing each module properly. The aim of this project is to make LPython work for any Python code down the road.

See #200 as a related issue. Feel free to discuss the details with us.

Skills preferred: Python and C++ programming

Difficulty: intermediate, 350 hours

Mentors: Ondřej Čertík (@certik), Naman Gera, Smit Lunagariya

Medium Priority

Improve x86 code generation

LPython 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 LPython, 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 Python features.

If you have any questions, please do not hesitate to ask, we can discuss or provide more details.

Mentors: Ondrej Certik (@certik), Gagandeep Singh

Difficulty: intermediate, 350 hours

Low Priority

Automatic Python wrapping

Add a backend to LPython that automatically exposes (eventually all) LPython module contents to Python. That will allow using LPython compiled code to be used from CPython itself.

Related issues:

Mentors: Ondrej Certik (@certik), Rohit Goswami

Difficulty: intermediate, 350 hours