Using Kronos from the Command Line
The history of programming is rich with wonders worked through the power of terminals. You can use Kronos as a traditional compiler, or interact with a REPL prompt from your shell of choice.
kc is the static compiler of the suite. It is designed to read in textual source files or the console standard input. By default, kc outputs an object file in the format native to the system toolchain (elf on Unix, PE/COFF on Windows). The object is built from a specified entry point, which is the function
Main() by default. You can override the entry point with the
The callable functions provided by
Evaluate, which is used for directly calling the main function. In addition, any reactive inputs in the program, such as audio or control inputs, become activation entry points such as
TickAudio. These enable reactive multi-rate integration as C-callable functions. An optional prefix can be added to all the entry points to enable simple namespacing, provided with the -P switch.
krepl is a command read-eval-print-loop interfaced with the Kronos JIT compiler. When you type an expression, it compiles it immediately to native code, executes and prints out the result. By default,
krepl starts in interactive mode. If there are any unlabeled command line parameters, they are passed to the REPL in sequence, after which the REPL exists unless
-I was specified.
krepl supports sound output. The global scope symbol
snd is monitored, and connected to the audio output whenever its derived type is a set of signals in the floating point format. You can silence the audio by providing non-sonifiable signal, such as
snd = nil.
If you redefine any symbol involved in the current streaming
snd, the signal processor is automatically recompiled.
krpc is a version of
krepl intended as a subprocess repl, using the JsonRPC protocol. It is primarily used by the Sublime Text plugin, but could be used to develop an integration with any other editor as well.
krpcsrv is a version of
krepl intended as a repl server. Please note that this is inherently dangerous, as the server allows remote code execution by design. That is why the server only accepts local connections by default.
krpcsrv can act as the backend code generator for native patching.