# Joy Interpreter

## `joy.joy`

This module implements an interpreter for a dialect of Joy that attempts to stay very close to the spirit of Joy but does not precisely match the behaviour of the original version(s) written in C.

`joy.joy.``joy`(stack, expression, dictionary, viewer=None)

  Evaluate the Joy expression on the stack.

  The basic joy() function is quite straightforward. It iterates through a sequence of terms which are either literals (strings, numbers, sequences) or functions. Literals are put onto the stack and functions are executed.

  Parameters:

  - stack (stack) – The stack.
  - expression (stack) – The expression to evaluate.
  - dictionary (dict) – A `dict` mapping names to Joy functions.
  - viewer (function) – Optional viewer function.

  Return type: | (stack, (), dictionary)

`joy.joy.``repl`(stack=(), dictionary=None)

  Read-Evaluate-Print Loop

  Accept input and run it on the stack, loop.

  Parameters:

  - stack (stack) – The stack.
  - dictionary (dict) – A `dict` mapping names to Joy functions.

  Return type: | stack

`joy.joy.``run`(text, stack, dictionary, viewer=None)

  Return the stack resulting from running the Joy code text on the stack.

  Parameters:

  - text (str) – Joy code.
  - stack (stack) – The stack.
  - dictionary (dict) – A `dict` mapping names to Joy functions.
  - viewer (function) – Optional viewer function.

  Return type: | (stack, (), dictionary)