Next: 2.6 Error handling Up: 2. Onyx Language Reference Previous: 2.4 Standard I/O Contents Index

# 2.5 Interpreter recursion

During typical Onyx interpreter initialization, the start operator is executed, which in turn executes a file object corresponding to stdin. However, depending on how the interpreter is invoked, the initial execution stack state may differ.

The interpreter can be recursively invoked. For example, if the following code is executed, the eval operator recursively invokes the interpreter to interpret the string.

    `2 2 add' cvx eval

The depth of the execution stack directly corresponds to the recursion depth of the interpreter. Execution stack depth is limited in order to catch unbounded recursion.

Onyx converts tail calls in order to prevent unbounded execution stack growth due to tail recursion. For example, the following code does not cause the execution stack to grow:

    $foo {foo} def
    foo

The following code will result in an execution stack overflow:

    $foo {foo `filler'} def
    foo