Packages

p

scala.tools.nsc

interpreter

package interpreter

Content Hierarchy
Ordering
  1. Alphabetic
Visibility
  1. Public
  2. Protected

Type Members

  1. class AbstractOrMissingHandler[T] extends PartialFunction[Throwable, T]
  2. trait ExprTyper extends AnyRef
  3. 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.

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

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

  12. class Power[ReplValsImpl <: ReplVals] extends AnyRef

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

  13. trait PresentationCompilation extends AnyRef
  14. trait PresentationCompilationResult extends AnyRef

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

  15. 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.)

  16. trait ReplCore extends AnyRef

    The subset of the Repl used by sbt.

  17. trait ReplDir extends AbstractFile with Clearable

    Directory to save .class files to.

  18. trait ReplGlobal extends Global
  19. class ReplOutput extends AnyRef
  20. trait ReplReporter extends FilteringReporter
  21. trait ReplRequest extends AnyRef
  22. 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.

  23. class ScriptedInterpreter extends IMain with ScriptedRepl
  24. trait ScriptedRepl extends Repl

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

  25. trait StdReplTags extends StdTags
  26. class StdReplVals extends ReplVals

Value Members

  1. object AbstractOrMissingHandler
  2. object IMain

    Utility methods for the Interpreter.

  3. object ImportContextPreamble extends java.io.Serializable
  4. object NamedParam extends NamedParamCreator
  5. 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.

  6. object ReplStrings
  7. object ReplVals
  8. object Results
  9. object StdReplTags extends StdTags with StdReplTags

Ungrouped