Integrating libSyntax with the Rest of the Compiler Pipeline - GSoC 2019 Summary

This summer I joined the Swift organisation for Google Summer of Code under the supervision of my mentor Rintaro Ishizaki @rintaro. See the original announcement from @akyrtzi here.

Summary

The goal of my GSoC project was to integrate the Syntax library into the compiler pipeline. That means creating the Syntax tree directly in Parser (not through SyntaxParsingContext) and using it to derive the AST required by the rest of the compiler with a new transformer.

Done

In the beginning I was assigned a bug SR-10620 which was fixed by PR #24785.

My second merged pull request #25193 set up the infrastructure necessary for incremental development of the project and refactored literal parsing.

The third merged pull request #26478 refactored all of type parsing and provided more infrastructure for handling recursive grammar rules.

My last PR #26738 contains parts of expression parsing refactored and is expected to be merged soon.

To Do

As of August 28, 2019, the remaining work is:

  • refactor the rest of expression parsing,
  • refactor statement parsing,
  • refactor declaration parsing.

Although the project originally aimed to deal with those as well, accommodating not only Syntax but also its C counterpart (for SwiftSyntax bindings) in the parser caused delays.

If you have any questions, I'll be happy to answer them.

7 Likes

Thank you and your mentor for your work !

I was offered GSOC too, though I did not take the opportunity, so the following question are more focused on that than the work that was done.

  • Did you have the same "awake hours" as your mentor, and was it important (if yes/no) ?
  • How did you organise yourself ?
  • How did you choose what to work on ?
  • Did you enjoy doing this ?
  • Would you recommend the experience ?
1 Like

I lived in Germany at the time and my mentor is based in California, so I was 9 hours ahead. Most of our communication took place after 7 PM from my point of view. Not ideal, but since I'm a night owl, it was manageable.

I set my work hours based on my lectures at uni and leisure activities. In my proposal, I had an outline of which parts of the parser should be refactored at what point, so I stuck to it. When I had a choice what to work on, I usually picked what seemed simple and left the complex stuff for later.

I did enjoy the aspect of working on a relatively important aspect of a widely-used piece of software. Getting to know such a large code base was definitely challenging, but really rewarding when something clicked for me. Also great was the company of very smart people that I can learn so much from.
That said, it was a good lesson in the importance of work-life balance.

Yes, I definitely recommend it! GSoC is a great way to get experience in a field that would usually be much harder to get into.

4 Likes