Swift Introduction

About Swift

Build on the best of C and ObjC. Adopt safe programming patterns and more features to make programming easier with lots of fun. ObjC itself has evolved to support blocks, collection literals so that ground works helps a lot.

Swift feels familiar to ObjC developers also provide seamless access to existing cocoa frameworks.

It is a first industrial quality system programming language that is expressive and enjoyable as a scripting language. Supports playground, an innovative way that allows programmers to experiment the code see the results and no need to even building and running it.

The compiler is optimised for performance and language is optimised for development.

Language features:

Easy to read and maintain, Safe (optional), unified memory management, less code, faster,

Compiler Architecture.

The compiler is responsible for translating Swift code into efficient and executable machine code. here are few major components.

Parsing: Recursive-descent parser with an integrated hand coded lexer. Parser responsible for generating Abstract Syntax Tree also emit the warning or errors for grammatical problems.

Semantic Analysis: Take the AST and transform into well formed, full typed checked. Emits warning and semantic problems. (Type inference).

Clang importer: imports the clang modules and maps the C or ObjC APIs they export into their corresponding Swift APIs.

SIL Generation: Swift Intermediate Language is a high level,  suitable for further analysis and optimisation of swift code.

SIL Guaranteed transformation: Perform additional data flow diagnostics that affect the correctness of the program.

SIL Optimisation: perform high level, Swift specific optimisations including ARC, de virtualisation.

LLVM IR Generation: IR generation lowers SIL to LLVM IR so LLVM continue to optimise and generate machine code.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.