/usr/share/SuperCollider/HelpSource/Classes/Interpreter.schelp is in supercollider-common 1:3.6.3~repack-5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | class::Interpreter
summary:: The interpreter defines a context in which interactive commands are compiled and executed.
categories:: Core>Kernel
description::
In the interpreter, code::this:: refers to the interpreter itself, e.g.: code::this.postln::
classMethods::
private::new
instanceMethods::
subsection::Accessing
The interpreter defines instance variables code::a:: through code::z:: which are always available in the interpreter. By convention, the variable code::s:: is used to hold the default Server. Assigning another value to code::s:: may cause some of the examples in the documentation to fail.
method::clearAll
set the values of the variables code::a:: through code::z:: to nil.
code::
x = 123;
x.postln;
this.clearAll;
x.postln;
::
subsection::Compile & Interpret
method::interpret
Compile and execute a link::Classes/String::.
code::
this.interpret("(123 + 4000).postln");
::
method::interpretPrint
Compile and execute a link::Classes/String::, printing the result.
code::
this.interpretPrint("123 + 4000");
::
method::compile
Compile a String and return a link::Classes/Function::.
code::
(
z = this.compile("(123 + 4000).postln");
z.postln;
z.value;
)
::
method::compileFile
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.
method::executeFile
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.
method::cmdLine
Returns the previosly interpreted code.
code::
1 + 2;
this.cmdLine
::
method::codeDump
this interpreter variable can be set to evaluate a function with any sucessfully compiled code.
see e.g. the class History.
code::
a = [ ]; // store all the code evaulated in a
this.codeDump = { |code| a = a.add(code) };
1 + 3;
f = { "hallo" };
a.postcs;
codeDump = nil; // reset to nil.
::
method::preProcessor
can be used to modify code before it is interpreted. Given appropriate delimiters, this can be used to implement little languages.
code::
// silly but simple: understand a Saw for every SinOsc
this.preProcessor = { |code| code.replace("SinOsc", "Saw") };
{ SinOsc.ar(200) * 0.1 }.play;
preProcessor = nil; // reset to nil.
::
|