Simple question really, however there doesn't seem to be a straight answer in the current developer documentation.
Does Swift compile to machine language (i.e. assembly), or does it compile to some intermediary form that then runs on a virtual machine?
(I suspect it does, but being unfamiliar with development in Apple's world it is not clear to me like it may be to someone who is.)
Swift is a compiled language means before producing the actual output Swift perform various activities. These activities are generally performed by the Swift compiler.
As a whole, the Swift compiler is principally responsible for translating Swift source code into efficient, executable machine code. However, the Swift compiler front-end also supports a number of other tools, including IDE integration with syntax coloring, code completion, and other conveniences.
Installing Swift (virtual machine)You can install Swift with an all-in-one virtual machine by following instructions here: http://swift.openstack.org/development_saio.html.
The Swift compiler is written mostly in C++, and this won't change in the near future. You can extend the standard library using Swift, but if you want to contribute a new language feature or some optimization, you'll need to write C++.
Yes, it compiles to machine language by way of LLVM Bitcode and, as @connor said, runs on top of the Objective-C runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With