What required knowledge we need to know before we can read the Swift source?

I have very limited compiler knowledge, please someone helps to share some thoughts.

The compiler is a few hundred thousand lines of code, so it's a bit hard to give a general recommendation. We have some documentation on the different subsystems (although, a bit of warning, some of it may be out-of-date). If you like watching talks or reading blog posts, we have some external resources listed as well. That said, those aren't pre-requisite knowledge, it may be helpful to pick-and-choose as you explore different parts of the compiler.

Is there a specific part of the compiler that you are interested in?

1 Like

It's also useful to note that the Standard Library, which contains a lot of what people think of as "Swift", is written in Swift itself and generally somewhat more approachable to people without compiler experience.

3 Likes

With the caveat that there are unique aspects of working with the standard library, particularly since ABI stability, that don't apply to other projects written in Swift. None of this is insurmountable but it's important to be aware that there is still a learning curve (unfortunately).

There's a document in the repository with some information about writing for the standard library, and others about ABI stability, but some of this isn't well documented (the right incantation of inlinability annotations to make things "work" when an API is added or modified is something of a dark art).

1 Like

Oh definitely. The "somewhat" in "somewhat more approachable" is load bearing :sweat_smile:

2 Likes

Thanks for all you sharing.

According to Swift.org - Swift Compiler, I am interested in the Parse, Sematic analysis, and SIL generation.

Terms of Service

Privacy Policy

Cookie Policy