Scala Compiler2.13.17 < Back


# Packages

-  package root

  The Scala compiler and reflection APIs.

  The Scala compiler and reflection APIs.

  Definition Classes
    root
-  package scala
  Definition Classes
    root
-  package tools
  Definition Classes
    scala
-  package nsc
  Definition Classes
    tools
-  package ast
  Definition Classes
    nsc
-  package backend
  Definition Classes
    nsc
-  package classpath
  Definition Classes
    nsc
-  package doc
  Definition Classes
    nsc
-  package fsc
  Definition Classes
    nsc
-  package interactive
  Definition Classes
    nsc
-  package interpreter
  Definition Classes
    nsc
-  package jline
-  package shell
- ATFT
- AbstractOrMissingHandler
- CompletionCandidate
- ExprTyper
- IMain
- ImportContextPreamble
- Imports
- InteractiveReader
- MemberHandlers
- NamedParam
- NamedParamClass
- NamedParamCreator
- Naming
- Phased
- Power
- PresentationCompilation
- PresentationCompilationResult
- Repl
- ReplCore
- ReplDir
- ReplGlobal
- ReplOutput
- ReplReporter
- ReplRequest
- ReplStrings
- ReplVals
- Results
- ScriptedInterpreter
- ScriptedRepl
- StdReplTags
- StdReplVals
- TokenData
- {{
-  package io
  Definition Classes
    nsc
-  package javac
  Definition Classes
    nsc
-  package plugins
  Definition Classes
    nsc
-  package profile
  Definition Classes
    nsc
-  package reporters
  Definition Classes
    nsc
-  package settings
  Definition Classes
    nsc
-  package symtab
  Definition Classes
    nsc
-  package tasty
  Definition Classes
    nsc
-  package transform
  Definition Classes
    nsc
-  package typechecker
  Definition Classes
    nsc
-  package util
  Definition Classes
    nsc

p

scala.tools.nsc

# interpreter

#### package interpreter

Content Hierarchy

Ordering

1. Alphabetic

Visibility

1. Public
2. Protected

### Package Members

1.  package jline
2.  package shell

### Type Members

1.  trait ATFT[G <: Global] extends AnyRef
2.  case class CompletionCandidate(name: String, arity: Arity = CompletionCandidate.Nullary, isDeprecated: Boolean = false, isUniversal: Boolean = false, declString: () => String = () => "", alias: Option[String] = None) extends Product with Serializable
3.  trait ExprTyper extends AnyRef
4.  class IMain extends Repl with Imports with PresentationCompilation with Closeable

   An interpreter for Scala code.

   An interpreter for Scala code.

   The main public entry points are compile(), interpret(), and bind(). The compile() method loads a complete Scala file. The interpret() method executes one line of Scala code at the request of the user. The bind() method binds an object to a variable that can then be used by later interpreted code.

   The overall approach is based on compiling the requested code and then using a Java classloader and Java reflection to run the code and access its results.

   In more detail, a single compiler instance is used to accumulate all successfully compiled or interpreted Scala code. To "interpret" a line of code, the compiler generates a fresh object that includes the line of code and which has public member(s) to export all variables defined by that code. To extract the result of an interpreted line to show the user, a second "result object" is created which imports the variables exported by the above object and then exports members called "$eval" and "$print". To accommodate user expressions that read from variables or methods defined in previous statements, "import" statements are used.

   This interpreter shares the strengths and weaknesses of using the full compiler-to-Java. The main strength is that interpreted code behaves exactly as does compiled code, including running at full speed. The main weakness is that redefining classes and methods is not handled properly, because rebinding at the Java level is technically difficult.

5.  case class ImportContextPreamble(exclude: Set[String], include: Set[String], preamble: String) extends Product with Serializable
6.  trait Imports extends AnyRef
7.  trait MemberHandlers extends AnyRef
8.  trait NamedParam extends AnyRef
9.  case class NamedParamClass(name: String, tpe: String, value: Any) extends NamedParam with Product with Serializable
10.  trait NamedParamCreator extends AnyRef
11.  trait Naming extends AnyRef
12.  trait Phased extends AnyRef

    Mix this into an object and use it as a phasing Swiss Army knife.

13.  class Power[ReplValsImpl <: ReplVals] extends AnyRef

    A class for methods to be injected into the intp in power mode.

14.  trait PresentationCompilation extends AnyRef
15.  trait PresentationCompilationResult extends AnyRef

    Created by scala.tools.nsc.interpreter.Repl#presentationCompile

16.  trait Repl extends ReplCore

    Interface to the repl for use by the frontend (shell, the UI).

    Interface to the repl for use by the frontend (shell, the UI).

    The interface should not depend on symbols and types (the compiler's internal state). At most, expose untyped trees and positions in addition to standard Java types. This decoupling would allow running the shell in a separate thread, or even in a separate process from the compiler. It should also be possible to write a new REPL frontend using this interface, and be compatible across minor compiler releases.

    (The first iteration of this interface is only uses Positions and standard JVM types, but we could loosen that.)

17.  trait ReplCore extends AnyRef

    The subset of the Repl used by sbt.

18.  trait ReplDir extends AbstractFile with Clearable

    Directory to save .class files to.

19.  trait ReplGlobal extends Global
20.  class ReplOutput extends AnyRef
21.  trait ReplReporter extends FilteringReporter with ReplStrings
22.  trait ReplRequest extends AnyRef
23.  trait ReplStrings extends AnyRef
24.  abstract class ReplVals extends AnyRef

    A class which the repl utilizes to expose predefined objects.

    A class which the repl utilizes to expose predefined objects. The base implementation is empty; the standard repl implementation is StdReplVals.

25.  class ScriptedInterpreter extends IMain with ScriptedRepl
26.  trait ScriptedRepl extends Repl

    The interface used to expose the repl as a Java Script Engine

27.  trait StdReplTags extends StdTags
28.  class StdReplVals extends ReplVals
29.  case class TokenData(token: Int, start: Int, end: Int, isIdentifier: Boolean) extends Product with Serializable

### Value Members

1.  object AbstractOrMissingHandler
2.  object CompletionCandidate extends java.io.Serializable
3.  object IMain

   Utility methods for the Interpreter.

4.  object ImportContextPreamble extends java.io.Serializable
5.  object NamedParam extends NamedParamCreator
6.  object Naming

   This is for name logic which is independent of the compiler (notice there's no Global.) That includes at least generating, metaquoting, mangling, and unmangling.

7.  object ReplStrings
8.  object ReplVals
9.  object Results
10.  object StdReplTags extends StdTags with StdReplTags
11.  object {{

    A magic symbol that, when imported in a REPL template, bumps the effective nesting level of the typechecker.

    A magic symbol that, when imported in a REPL template, bumps the effective nesting level of the typechecker.

    The REPL inserts this import to control scoping in code templates, without excessive lexical noise.

        import p.X
        import scala.tools.nsc.interpreter.`{{`
        import q.X
        X           // q.X

    Its name is chosen to suggest scoping by braces; the brace is doubled to avoid confusion in printed output, as the name will be visible to a REPL user inspecting generated code.

    There is no complementary symbol to restore the nesting level.

### Deprecated Value Members

1.  object InteractiveReader
   Annotations
     @deprecated
   Deprecated

     (Since version 2.9.0) Use a class in the scala.tools.nsc.interpreter package.

### Ungrouped