Class Interpreter

A class responsible for interpreting parsed code and executing it based on a specific language structure.

Constructors

Properties

Accessors

Methods

Constructors

Properties

options: Partial<IInterpreterOptions> = DefaultInterpreterOption

Optional configuration for the interpreter (defaults to DefaultInterpreterOption).

Accessors

  • get code(): string
  • Getter for the source code being interpreted.

    Returns string

    The original source code.

Methods

  • Runs the interpretation of the parsed code, simulating the execution and producing output.

    Returns {
        executionTime: number;
        internal: {
            bits: Int32Array<ArrayBuffer>;
            pointer: number;
            print: () => string;
        };
        output: string;
    }

    An object containing the internal state of the interpreter, the output produced, and the execution time.

  • Creates an instance of the interpreter by parsing the provided code and applying optional configuration.

    Parameters

    • code: string

      The source code to interpret.

    • Optionaloptions: Partial<IInterpreterOptions>

      Optional configuration for the interpreter, including parser settings.

    Returns Interpreter

    A new Interpreter instance.