Numeriqueue

From Esolang
Jump to navigation Jump to search

Numeriqueue is a esolang based on Call Queue.

The program consists of a set of functions, which can have zero or arguments, and which have no return values. One function is the starting function.

The arguments of a function have types, which can be:

  • A natural number
  • A function name, with a list of argument types

The types are allowed to be polymorphic, but they must have types. Also, wherever a function with no arguments is expected, a number is also valid, although the converse is not true.

The function body consist of the list of zero or more statements. A statement consists of a number or a function call. A function call also specifies the argument values of the call, which can be numbers or function names (you can't specify the arguments of the arguments though). Anywhere a number or function name is expected, you can also give an argument to this function. In the case of a numeric argument, you can also specify a constant value to add to the argument value.

Execution is done with a queue of statements (with all argument values already filled in). The first statement is removed from the queue, and then does depending what it is:

  • If a number, output that number and then that many further statements from the beginning of the queue are discarded without being executed.
  • If a function call, then append all statements of that function to the queue, replacing all arguments with their values.

Once the queue is empty then it is finish.