Runtime Commands
In addition to expressions, Lavender programs may contain commands that change the state of the runtime. Runtime commands may only appear at the top level, and follow the format below. @ <command> [args...] Unlike expressions, runtime commands do not produce values and cannot interact with program state. Runtime commands are similar to C language preprocessor directives, except that they are executed at runtime in line with the source code. In particular, commands must be on a line of their own and may not span multiple lines.
The list of runtime commands is as follows.
| Command Format | Description |
|---|---|
@import <file> |
Evaluates the contents of the specified file. The file location is first checked relative to the filepath specified with the -fp command line option, and then to the working directory. |
@using <name> |
If the name is a qualified name, makes that name visible in the current namespace, else the name is treated as a namespace and all names in that namespace are made visible in the current namespace. |
@forward <func-decl> |
(Java only). Forward declares the given function. The function's name may be used from this point on as if the function had been defined (however evaluating such expressions is an error). The actual definition of the function must have the same function heading, including number of parameters and passing conventions. |
@resolve [files...] |
(Java only). Evaluates the given files and links all imported files. Linking replaces uses of forward declarations of functions with the actual function. It is an error if not all functions have been defined at the point this command is executed. |
@library <lib> |
(Java only). Loads the functions in the given library. The library in this runtime is a Java class file on the classpath, which includes the Lavender filepath. |
@delete <qual-name> |
Unbinds the specified name from the function it denotes. The name may be used to define a new function. The old function itself is not deleted, and previous uses of the name still refer to the old function. |
@quit |
Terminates the runtime. |
@dump |
Dumps information about the runtime to the console. |