Interpreter:
Filter:
Classes | Core > Kernel

Interpreter : Object

The interpreter defines a context in which interactive commands are compiled and executed.
Source: Kernel.sc

Description

The interpreter is an object that handles the translation and execution of code at runtime. It is that what runs any program code and defines a context for it.

Class Methods

Inherited class methods

Instance Methods

Accessing

In the interpreter, this refers to the interpreter itself, e.g.: this.postln

The interpreter defines global variables (az), that can be used for interactive programming. Except these single letter variables ("interpreter variables"), all variables have to be defined by the keyword var (see: Assignment Statements, and Scoping and Closure).

NOTE: Use these variables with a bit of extra care – as they are global, they remain in memory and one piece of code may happen to interfere with another one. The variable s is by convention bound to the default server (Server) and should not be changed.

.clearAll

set the values of the variables a through z to nil.

Compile & Interpret

.interpret(string ... args)

Compile and execute a String.

.interpretPrint(string ... args)

Compile and execute a String, printing the result.

.compile(string)

Compile a String and return a Function.

.compileFile(pathName)

Reads the file at pathName, compiles it and returns a Function. The file must contain a valid SuperCollider expression, naturally. This will not compile class definitions, only expressions.

.executeFile(pathName ... args)

Reads the file at pathName, compiles it and executes it, returning the result. The file must contain a valid SuperCollider expression, naturally. This will not compile class definitions, only expressions.

.cmdLine

.cmdLine = value

Returns the previously interpreted code.

.codeDump

.codeDump = value

this interpreter variable can be set to evaluate a function with any successfully compiled code. see e.g. the class History.

.preProcessor

.preProcessor = value

If this is set to a function, all interactively executed code is piped through it before parsing and interpreting. This is mostly used for developing domain-specific live coding languages that piggyback off the SuperCollider editing environment.

This function is called by Interpreter: -interpretPrintCmdLine with two arguments: the code string and the interpreter itself.

.a

.a = value

.b

.b = value

.c

.c = value

.d

.d = value

.e

.e = value

.f

.f = value

.g

.g = value

.h

.h = value

.i

.i = value

.j

.j = value

.k

.k = value

.l

.l = value

.m

.m = value

.n

.n = value

.o

.o = value

.p

.p = value

.q

.q = value

.r

.r = value

.s

.s = value

.t

.t = value

.u

.u = value

.v

.v = value

.w

.w = value

.x

.x = value

.y

.y = value

.z

.z = value

Global variables ("interpreter variables") for interactive programming (see Accessing).

.functionCompileContext

The compiler uses this method as a virtual context in which to compile code.

Inherited instance methods

Undocumented instance methods

.interpretCmdLine

.interpretPrintCmdLine

.shallowCopy