[swift-dev] [Starter Project] Teach SILParser how to parse switch_enum of undef.

Michael Gottesman mgottesman at apple.com
Tue Dec 22 13:45:16 CST 2015


Here are some off the top of my head. Many are related to code quality. Tell me what you think:

1. We have recently gotten some SILParser crashers. These need to be fixed. I looked at 1-2 of them and the ones I looked at are where we should be giving out a diagnostic but are instead just asserting.

2. The SILParser is a recursive descent parser. In general when one implements a recursive descent parser, one should above the routine that does the various parts of the parsing show the grammar being parsed. SILParser has inconsistently done this. I would go through all of the methods and see which are missing this documentation and fix the documentation.

3. parseSILInstruction is horrible and makes me cry every time I see it. It is a method that is ~1900 lines with a huge switch in it. We should refactor it into a visitor structure. In fact it is large enough that we should consider moving it into its own file if it is possible.

Michael

> On Dec 22, 2015, at 12:02 PM, Davide Italiano <dccitaliano at gmail.com> wrote:
> 
> 
> 
> On Sun, Dec 13, 2015 at 4:29 PM, Michael Gottesman via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
> This is a small starter project for those who are interested in working with SIL.
> 
> The SIL Parser currently is unable to parse switch_enum of undef. I wrote a patch that does the work some time ago, but I never have had time to finish it (i.e. make sure everything works ok/write tests). I posted the patch in this issue:
> 
> https://bugs.swift.org/browse/SR-210 <https://bugs.swift.org/browse/SR-210>
> 
> My hope is that even though a lot of the work is already done this may serve as good starting point for someone who wants to poke at the SIL Parser (a part of the code base that has not gotten as much attention as others).
> 
> Michael
> 
> 
> Hi Michael,
> I'm interested in something like this. I noticed this project has been already taken, but you mentioned in a subsequent mail you have a list of them. What are the other proposals?
> 
> Thank you,
> 
> --
> Davide

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20151222/aace2035/attachment.html>


More information about the swift-dev mailing list