Dotty Documentation

0.5.0-bin-SNAPSHOT

package dotty.tools.repl
extends Object

[-] Constructors

[-] Members

A class loader that loads files from a [[scala.tools.nsc.io.AbstractFile]].

[+] class AmmoniteReader

Adaptation of the Ammonite shell emulator to fit the Dotty REPL

Credit for the code in the terminal goes to Li Haoyi who wrote most of it as part of Ammonite.

[+] object AmmoniteReader
[+] sealed trait Command

A command is on the format:

:commandName <optional arguments...>

The Command trait denotes these commands

[+] case class Completions

A list of possible completions at the index of cursor

[+] object Completions

A list of possible completions at the index of cursor

[+] object Help

:help shows the different commands implemented by the Dotty repl

[+] object Imports

:imports lists the imports that have been explicitly imported during the session

[+] case class Load

:load <path> interprets a scala file as if entered line-by-line into the REPL

[+] object Load
[+] object Main

Main entry point to the REPL

[+] object Newline

Parsed result is simply a newline

[+] object ParseResult
[+] sealed trait ParseResult

A parsing result from string input

[+] case class Parsed

An error free parsing resulting in a list of untyped trees

[+] object Parsed

An error free parsing resulting in a list of untyped trees

[+] object Quit

:quit exits the repl

[+] class REPLFrontEnd

A customized FrontEnd for the REPL

This customized front end does not perform parsing as part of its runOn method. This allows us to keep the parsing separate from the rest of the compiler pipeline.

[+] class Rendering

This rendering object uses ClassLoaders to accomplish crossing the 4th wall (i.e. fetching back values from the compiled class files put into a specific class loader capable of loading from memory) and rendering them.

[+] object Rendering

This rendering object uses ClassLoaders to accomplish crossing the 4th wall (i.e. fetching back values from the compiled class files put into a specific class loader capable of loading from memory) and rendering them.

[+] class ReplCompiler

This subclass of Compiler replaces the appropriate phases in order to facilitate the REPL

Specifically it replaces the front end with REPLFrontEnd, and adds a custom subclass of GenBCode. The custom GenBCode, REPLGenBCode, works in conjunction with a specialized class loader in order to load virtual classfiles.

[+] class ReplDriver

Main REPL instance, orchestrating input, compilation and presentation

[+] object ReplDriver

Main REPL instance, orchestrating input, compilation and presentation

[+] object Reset

Reset the session to the initial state from when the repl program was started

[+] final class ShowUser
[+] object ShowUser
[+] object SigKill

ctrl-c obtained from input string

[+] case class State

The state of the REPL contains necessary bindings instead of having to have mutation

The compiler in the REPL needs to do some wrapping in order to compile valid code. This wrapping occurs when a single MemberDef that cannot be top-level needs to be compiled. In order to do this, we need some unique identifier for each of these wrappers. That identifier is objectIndex.

Free expressions such as 1 + 1 needs to have an assignment in order to be of use. These expressions are therefore given a identifier on the format resX where X starts at 0 and each new expression that needs an identifier is given the increment of the old identifier. This identifier is valIndex.

[+] object State

The state of the REPL contains necessary bindings instead of having to have mutation

The compiler in the REPL needs to do some wrapping in order to compile valid code. This wrapping occurs when a single MemberDef that cannot be top-level needs to be compiled. In order to do this, we need some unique identifier for each of these wrappers. That identifier is objectIndex.

Free expressions such as 1 + 1 needs to have an assignment in order to be of use. These expressions are therefore given a identifier on the format resX where X starts at 0 and each new expression that needs an identifier is given the increment of the old identifier. This identifier is valIndex.

[+] final class StoreReporterContext
[+] case class SyntaxErrors

A parsing result containing syntax errors

[+] object SyntaxErrors

A parsing result containing syntax errors

[+] case class TypeOf

To find out the type of an expression you may simply do:

scala> :type (1 * 54).toString
String
[+] object TypeOf
[+] case class UnknownCommand

An unknown command that will not be handled by the REPL

[+] object UnknownCommand

An unknown command that will not be handled by the REPL

[+] object results

Contains the different data and type structures used to model results in the REPL

[+] def storeReporter : StoreReporter

Create empty outer store reporter