Quine Programming Language

Quine (the Quine Programming Language) is a programming language for writing quines, or rather, one specific quine.

Quine (at Github) is based on a virtual machine that contains a buffer holding the previous token, a main queue which can hold arbitrary tokens, and a standard output stream. The VM is manipulated by these machine language statements:

  • 000 - (e) - raise error: dump the contents of the main queue to standard output, followed by 'e' to indicate that an error has occurred.
  • 001 - (i) - disable copying of the previous token to the main queue (and indicate success) by writing current token to the main queue.
  • 010 - (n) - copy previous and current token to the main queue.
  • 011 - (q) - clear the main queue and commence normal operation.
  • 100 - (u) - undertake continuous copying of the previous token buffer to the main queue.

There are no other symbols or operators permitted.

White space is significant: there must be none.

The nature of the parser, tokenizer, and the virtual machine architecture mean that for complex reasons it is a syntax error to place the high level tokens in any order other than:

  1. q followed by
  2. u followed by
  3. i followed by
  4. n followed by
  5. e and nothing after this.

The consequence of this is that the only valid program in the language Quine is this:

quine

When executed it provides this output:

quine

"Quine" is perfect at producing quines. And "quine" is a perfect quine. Sure, you can write shorter quines, but can you really write * better * quines?

Quine's quine ("quine") is the perfect quine.

Though there's one quine that might be better -- that is the quine that has no code, and produces no output. The Empty Quine.

The Sound of No Quines Running

A quine that doesn't exist produces no output -- the result of which, when executed, produces no output.

One of the oldest and deepest questions in Quineology is the question of whether an empty quine can be a quine? And if not, then how can we speak of an empty quine?

See also at this current wiki