REPL and Debugger

The Swift.org community makes use of the LLDB debugger to provide a rich REPL as well as the debugging environment for the Swift Language. Swift is tightly coupled to the version of the Swift compiler embedded in the debugger. Tight integration of compiler and debugger enables accurate inspection of Swift types as well as full-featured expression evaluation in the context of a rapidly evolving language.

However, because of this tight integration, developers must use a matched pair of compiler and debugger built using the same sources. Debugging using any other version of LLDB can lead to unpredictable results.

Why Combine the REPL and Debugger?

Several motivating factors contributed to the decision to use the Swift debugger as a foundation for the Swift REPL.

Xcode Playground Support

Swift developers can approach the language in many different ways. In addition to the traditional command-line compiler and interactive REPL one of the earliest experiences for many developers was through the introduction of playgrounds in Xcode. Prior to Swift 3.0 and Xcode 8 this was only possible with the version of Swift included with Xcode. The Xcode Playground Support project enables building a Swift toolchain that includes everything necessary to integrate with the Xcode 8 playground experience. Playground Support will be included in corresponding snapshots. Download a snapshot, install it, and select the toolchain to work with the latest Swift features in Xcode playgrounds.

The project builds two frameworks: