Class: FishProgram

FishProgram(source, initialStackopt)

A runnable ><> program

Constructor

new FishProgram(source, initialStackopt)

Creates a new ><> program
Parameters:
Name Type Attributes Description
source String The program's source code
initialStack Array.<Number> <optional>
The program's initial stack. Defaults to an empty stack
Source:

Members

(static, constant) DIRECTION_CHANGERS :Array.<String>

List of dirtection changing characters
Type:
  • Array.<String>
Source:

(static, constant) LITERALS :Array.<String>

List of characters which should be treated as literal hex values
Type:
  • Array.<String>
Source:

(static, constant) MATH_OPERATORS :Array.<String>

List of math operator characters
Type:
  • Array.<String>
Source:

(static, constant) REFLECTION_INSTRUCTIONS :Array.<String>

List of reflection characters
Type:
  • Array.<String>
Source:

(static, constant) STACK_MANIPULATORS :Array.<String>

List of stack manipulator characters
Type:
  • Array.<String>
Source:

(readonly) error :Error

The error the program threw, if any. Null otherwise
Type:
  • Error
Source:

(readonly) grid :Array.<Array.<String>>

The program grid
Type:
  • Array.<Array.<String>>
Source:

hasTerminated :Boolenreadonly

Whether or not the program has finished
Type:
  • Boolenreadonly
Source:

(readonly) height :Integer

Height of the program
Type:
  • Integer
Source:

inputBuffer :Array.<Object>

A snapshot of the program's input stream's buffer
Type:
  • Array.<Object>
Source:

(readonly) instructionPointer :InstructionPointer

The instruction pointer of the program
Type:
Source:

(readonly) source :String

The source code of the program
Type:
  • String
Source:

(readonly) stack :FishStack

The program's stack
Type:
Source:

(readonly) width :Integer

Width of the program
Type:
  • Integer
Source:

Methods

advance() → {Boolean}

Advances the program one step
Source:
Throws:
If something smells fishy, or the program has already terminated
Type
Error
Returns:
True if the program finished with this advance. False otherwise
Type
Boolean

giveInput(c)

Gives a character to the program's input stream
Parameters:
Name Type Description
c String The character to give
Source:
Throws:
If c is not a string with exactly one character
Type
Error

readOutput()

Reads a value from the program's output stream
Source:
Throws:
If there is nothing to read
Type
Error