Onyx is a stack-based, threaded, interpreted language. Its closest relative is
Adobe PostScript, followed by Forth. Experienced PostScript programmers
should find most aspects of Onyx familiar, but there are significant differences
that will prevent a knowledgeable PostScript programmer from programming in Onyx
without first skimming this chapter. This chapter does not assume specific
knowledge of other programming languages, so stands as a definitive reference
for Onyx.
Onyx is different from most languages in that it is not compiled, but rather consumed. For example, there are mechanisms for creating the equivalent of named procedures that can be called at a later time, but behind the scenes, the code is actually being interpreted as it is scanned in such a way that an executable object is created. As such, Onyx is not suited for compilation, native or byte code. However, the language syntax is very simple and the scanner/parser is extremely fast. There is also an operator called bind that optimizes interpreted code execution to approximately the same performance level as would be expected of a byte code interpreter.
Onyx is implemented as a C library that can be embedded in other programs. Mechanisms are provided for extending the set of operators available. This manual only documents the base language; see application-specific documentation for any language extensions.
Following is a list of basic language features that are discussed in more detail later in this chapter: