HQ9+- is the long awaited extension of the excellent language HQ9++ created by David Morgan-Mar, which itself is an object-oriented extension of the esoteric HQ9+ authored by Cliff L. Biffle.


When the HQ9++ specification was unveiled, it was perceived by many to be the final step in the development of esoteric languages, and for good reasons. HQ9++ is elegant, simple, and yet powerful enough to accomplish every esoteric task. Much of its gracefulness is due to the transparent inclusion of the object-oriented paradigm.

There is, however, a fatal flaw in both of the parent languages: there hardly is any machinery to assist in the debugging of the code. HQ9+- alleviates this problem by introducing a concept which makes debugging and quality control easy and straightforward.

Language Concepts

HQ9+- maintains the backwards compatibility with both HQ9++ and HQ9+, as long as interpreters (compilers) are treating undocumented characters as comments. Strictly speaking, any correct HQ9+- program is also a correct HQ9++ program and will produce an identical output.

There are five operators:

H, Q, 9, +, -

The first four are the same as in the original specification.

Hello World!

H prints "Hello World!".


Q prints the text of the program.

99 Bottles Of Beer On The Wall

9 prints the (canonical) text of the song "99 Bottles Of Beer On The Wall".

Arithmetic And Objects

+ increments the counter. As in HQ9++, ++ increments the counter twice and creates an object of a new subclass of the generic superclass.

Quality Control

In order to facilitate the quality control, one new operator is added: - (minus sign). It is interpreted as follows:

  1. If it is the very first operator, then it is a syntax error.
  2. When the preceding character is H, it results in an I/O error.
  3. When the preceding character is Q, it enters the infinite recursion (a good implementation will crash when out of stack).
  4. When the preceding character is 9, it enters the infinite loop.
  5. When the preceding character is -, it decrements the counter.
  6. When the preceding character is +, it divides 1 by 0, unless
  7. the preceding characters are ++, in which case it throws a virtual exception, which itself is a method of an object of a new subclass of the generic superclass. In line with the best data-hiding principles, there is no way to intercept this exception.


We are proud to present an interpreter written in highly portable C. This is a new implementation of HQ9++, HQ9+-, and HQ9+, written entirely from scratch. It is licensed under GNU GPL, and is entirely free software. The following design goals were met:

  1. Portability: the code is very vanilla C, designed to build wherever a C compiler is available.
  2. Scalability: any program that can fit in your RAM will be correctly interpreted. A program with several tens of thousands Qs will run in a fraction of a second, unless constrained by slow IO.
  3. Performance: Object-oriented capabilities and some other functions are optimized so thoroughly that they conform fully with the specifications while consisting of mere 0 bytes of code.
  4. Strict adherence to standards: our implementation is case-insensitive, which is implied in the original specification of HQ9+. It will process UTF-8 files and binary files correctly, while regarding unknown characters as comments.
  5. Esoteric fidelity: our implementation of 9 fully conforms with the most authoritative tradition.

Download the source tarball: hq9+-i-9.9.txz


Original specification of HQ9+ by Cliff L. Biffle. (Internet Archive)

Original specification of HQ9++ by David Morgan-Mar.

See the Info page for copyright information.