TLDR: TECO uses single-character commands. When extending TECO to
add registers to store numeric values, there was a limited set of
unused characters left for the commands associated with this
q was chosen as one of these command characters
because it could serve as a mnemonic for "quantity." This led to the
numeric registers being called "Q-registers" and, though an
unfortunate misunderstanding, eventually this was applied to the
completely separate set (albeit sharing the same names) of text-valued
registers as well.
dirkt's answer gives us the paper describing the timeline of
how registers storing text and numeric values came about: "The
Beginnings of TECO" by the original author of TECO, Dan
On page 113 (PDF page 4), in the section "TECO becomes a programming
language," Murphy describes the appearance of storage registers:
By late 1962, TECO had about the level of capabilities that simple
editors would have for years to come, but TECO’s development didn’t
I added the concept of text variables—that is, a variable that would
hold an arbitrary section of text. The command to move a range of
text into a text variable was
x. (I was running low on unused
letters by then.) [emph. added] ...
g (get) was used to copy the
contents of a text variable into the main buffer at the editing
point.... Despite the lack of a mnemonic association for
quickly came to seem natural, almost intuitive. To
became as easily spoken and understood by TECO users as "store"
would have been.
He goes on to discuss a separate set of registers for numeric values,
sharing the same names:
Integer variables were also added around this time, again from the
single-letter set a–z, 0–9.
u (use) would store its argument into
the variable, and
q (quantity) would stand as the stored value in
an expression. The same variable name could have both a text and
numeric value; the command determined which was being referenced.
"Q-register" was a natural name for the registers retrieved by the
command. The name "Q-register" had been codified by October 1964: Daniel J.
Edwards, in PDP-6 Memo No.2 / Memorandum MAC-M-191 ("TECO 6")
describes them and the five commands that operate on them (p.4):
Q registers are general storage registers for
2) buffer pointers
4) macro definitions
There are 36 Q registers and they are referred to by Qn where n is a
single letter or digit. The following commands pertain to Q registers.
xUQn The value of the arithmetic expression x is placed
mXQn m lines of text starting at the current buffer pointer
are copied into Qn.
b,cXQn Text between buffer pointers b and c is copied into Qn.
QnG Get text stored in Qn and insert at the current text
buffer pointer. The contents of Qn are unchanged.
QnM Macro: text stored in Qn is executed as a TECO com-
MIT was using what appears to be a separate line of TECO
development (probably starting with the PDP-1) that merged the Q
and G registers together, as you can see above. (Peter Samson's July 1965
AIM-81 "PDP-6 TECO" also describes merged registers, though
mysteriously it seems to have separate commands again for moving numeric
and textual values out of the registers; using the wrong one "does not make
sense" (p.5), presumably resulting in rubbish output.)
The original version with separate "Q" and "G" registers either continued
to be developed or the split was restored, but MIT's usage seems to have
stuck even for these versions. The Standard TECO User's Guide and
Language Reference Manual (May, 1985, describing TECO-11
version 40, TECO-10 version 3 and TECO-8 version 7) uses "Q-register" to
refer to both the text and integer registers though these are clearly two
separate sets of storage:
TECO provides data storage registers, called Q-registers, which
may be used to store single integers and/or ASCII character
strings. Each Q-register is divided into two storage areas. In
its numeric storage area, each Q-register can store one signed
integer. In its text storage area, each Q-register can store an
ASCII character string (which can be any text, including the
important case of a TECO command string).
So, to summarize, the numeric registers were reasonably referred to as
"Q-registers" because they were retrieved with the
q command, the merge
of "Q" and "G" registers caused MIT writers naturally to use just one name
for the merged registers, and the split-register versions of TECO picked up
this usage probably because it's simpler to say, and the two sets could
also be conceived as a single set due to the shared names.