Mouse
Peter Grogono's tiny stack-based language of single-character commands, introduced in BYTE in July 1979 as a high-level language that could run in 4K of memory and as a lesson in how interpreters work.
Created by Peter Grogono
Mouse is a very small interpreted programming language that Peter Grogono introduced to the hobbyist world in the July 1979 issue of BYTE. A Mouse program is just a string of characters, and the interpreter reads and acts on one character at a time. Every variable, operator, control structure and subroutine name is a single symbol. Expressions are written in postfix (Reverse Polish) notation and evaluated on a stack. Even so, Mouse has nested loops and conditionals, arrays, recursive subroutines with local variables, and parameter passing. Grogono’s goal was a language with many features of high-level languages that could still be implemented on “a minimal system consisting of a microprocessor, 4 K bytes of memory, and a terminal”.
The name is not an acronym. As Grogono put it in the original article, it is “merely an appropriate description for something small and active.”
History & Origins
From an electronic music studio
Mouse began in music, not in microcomputing. In his 1979 article Grogono explains that in 1970 he was working for Electronic Music Studios (London) Limited. Under Peter Zinovieff, the company (later the maker of the SYNTHI line of synthesizers) was looking at ways to use minicomputers to control electronic instruments. The studio had two DEC PDP-8 computers but “very little software”. Grogono’s job was to spare composers the chore of entering their pieces as strings of octal numbers.
His answer was MUSYS, a high-level composition language whose core was “a simple yet powerful macroprocessor”. A MUSYS piece was a hierarchy of macros: the top-level ones set the overall form of the composition and the lowest-level ones gave the pitch and duration of single sounds. Memory was very tight. The PDP-8 that did the language processing had only 4K 12-bit words, and Grogono reports that the MUSYS interpreter itself came to about 700 instructions, plus about 600 more for supporting software such as disk control. He described the system in Software: Practice and Experience in 1973.
Grogono credits the idea of building a minicomputer language on a macroprocessor to a paper by the late Christopher Strachey: “A General Purpose Macrogenerator” (Computer Journal, 1965), which described the GPM. The 1979 article’s conclusion quotes Strachey’s warning that the GPM is “a very powerful tool in the hands of a ruthless programmer” but “something of a trap for the unsophisticated one”.
The 1979 BYTE article
When he wrote the BYTE article, Grogono was working at the Computer Centre of Concordia University in Montreal. The article, “Mouse: A Language for Microcomputers”, ran on pages 198–220 of the July 1979 issue. Its first half is a user’s guide to the language. Its second half gives a complete interpreter written in Pascal, which Grogono presents as “a machine independent guide to the implementation of Mouse in assembly or machine language” rather than as a production implementation. The interpreter kept the program text in a 500-character array.
Reader feedback arrived in the June 1980 issue. In “Comment and Correction for Mouse”, Tom Lane praised the decision to publish the interpreter in a high-level language and listed several typographical errors and genuine bugs in the listing. In his reply, Grogono said the bugs were “perhaps, partly due to my confusion between the old and new versions of the language”. He also proposed a design change: macro parameters should be numbered (1%, 2%, …) instead of lettered (%A, %B, …). That change appears in the later book version.
The 1983 book
In 1983 Petrocelli Books (New York) published Grogono’s Mouse: A Language for Microcomputers, a 151-page book. It revised the language and gave two complete interpreters, one in Pascal and one in Z80 assembly language. Enthusiasts now call this revised dialect Mouse-83 and the magazine version Mouse-79. (The CodeArchaeology encyclopedia lists “Mouse 83” as a separate entry.)
Some secondary sources say Mouse was designed as early as the mid-1970s. Grogono’s reply to Tom Lane in June 1980, that “Mouse is based on a language that I first implemented several years ago”, points to MUSYS as the earlier system, which matches the 1979 article’s statement that Mouse “is descended from” MUSYS. No independent dated source has been found for a standalone Mouse before 1979, so this page uses the date of first publication.
Design Philosophy
Grogono was open about the trade-offs he made to fit high-level features into a tiny interpreter:
- Single-letter identifiers. Variables and macros are named
AtoZ, so the interpreter needs no symbol table. - Postfix expressions. These are “more easily interpreted by a computer than the conventional infix notation”, so no parser or precedence rules are needed.
- Parameters passed as strings. Macro arguments are passed as text, which avoids complex parameter-passing machinery.
- Structured control flow only. Mouse has nested, single-entry control structures and “does not allow unrestricted jumps”, which Grogono tied to the principles of structured programming.
He admitted the cost: “Mouse programs are easier to write than to read, and it is possible to write Mouse programs that are very obscure”. He then pointed to APL as proof that this alone does not condemn a language. His summary of the language’s appeal was that “so much can be achieved with such a small amount of implementation effort.”
Key Features
Stack and variables
Every value goes through a stack. A number pushes itself, an operator pops its operands and pushes the result, and ! pops a value and prints it. A variable name pushes the variable’s address, and . replaces that address with the value stored there. In Mouse-79 the addresses of A to Z were simply 1 to 26, so B could also be reached as element 1 of an “array” starting at A. Grogono noted that the most common Mouse mistake is forgetting the period: no error is reported, and the program quietly calculates with an address instead of a value.
Control structures
| Construct | Form | Meaning |
|---|---|---|
| Conditional | E [ C ] | Run clause C if expression E is true |
| Loop | ( C1 E ^ C2 ) | Repeat, leaving at the ^ test when E is not true |
| Macro call | #M,P1,P2; | Call macro M with the text parameters P1, P2 |
| Macro definition | $M ... @ | Define macro M; @ returns |
The exit test can appear anywhere in a loop, and more than once. With the test at the start a loop acts as a while, and with it at the end it acts as a repeat ... until. In Mouse-79, “true” meant greater than zero. The 1979 article printed the loop-exit symbol as an upward arrow, the glyph that early ASCII used at the position ^ now occupies. Each macro call gets its own full set of local variables A to Z, which is what makes recursion work.
Mouse-79 versus Mouse-83
The book version changed some of the syntax:
| Feature | Mouse-79 (BYTE) | Mouse-83 (book) |
|---|---|---|
| Assignment | X 17 = (address, value, =) | 17 X : (value, address, :) |
| End of program | $$ | $ |
| Comparisons | none; tests are “greater than zero” | <, =, > return 1 or 0 |
| Macro parameters | %A, %B, … | 1%, 2%, … |
| Character I/O | none | ?' reads a character, !' prints one, 'C is a character literal |
| Remainder | none | \ |
| Comments | none | ~ to end of line |
| Tracing | none | { and } switch execution tracing on and off |
Examples
The first factorial program in the 1979 article reads a number and prints its factorial. It uses the top of the stack as an anonymous accumulator:
| |
N?= reads a number into N, and 1 starts the running product on the stack. Inside the loop, N.^ leaves when N is no longer positive, N.* multiplies the product by N, and NN.1-= decrements N. The final ! prints the result.
In Mouse-83, a greeting and a macro that adds its two parameters look like this:
| |
Evolution
| Period | Development |
|---|---|
| ~1970–1973 | MUSYS, Mouse’s macro-based predecessor, runs on PDP-8s at EMS in London |
| 1979 | Mouse-79 published in BYTE with a Pascal reference interpreter |
| 1980 | Bug fixes printed in BYTE; Grogono proposes numbered parameters |
| 1983 | Mouse-83 published in book form with Pascal and Z80 interpreters |
| 2000s | Hobbyist revival: a SourceForge project (2001), Sean Fuller’s “Great MOUSE Programming Language Revival” site, and David G. Simpson’s C interpreters and Mouse-2002 extension |
The CP/M interpreter in circulation is based on the book’s Z80 version and was updated by Lee R. Bradley, whose build is dated 2007. Simpson’s Mouse-2002 goes furthest from Grogono’s design. It makes every number floating-point and adds arrays, file I/O, global variables, a change-sign operator, an | “else” operator, an & operator for calling named functions, and an interactive mode.
Current Relevance
Mouse is a historical language and has no commercial use. It survives as a teaching tool and a hobbyist curiosity. Interpreters for all three dialects are freely available as C source from Simpson’s site, which also hosts the example programs from Grogono’s book (Tower of Hanoi, Quicksort, bubble sort, expression evaluation and others), and Grogono’s original Pascal interpreters are preserved there as well. The esoteric-languages wiki (esolangs.org) has an entry for Mouse because of its one-character syntax, but it was designed as a serious, minimal, general-purpose language.
Why It Matters
Mouse shows how much language fits in a very small interpreter: the 1979 reference version stored the whole program in a 500-character array. Grogono’s conclusion in 1979 was that Mouse “is simple enough to be implemented on a small computer system in a few days, yet it is rich enough to give insight into the mechanisms used by much higher level languages”. That is why the language is still worth studying. Arrays, local variables, recursion, and parameter passing by text substitution all appear in Mouse with almost nothing hiding the machinery.
It is also a direct link between two lines of computing history: Christopher Strachey’s macro-processor research and the early synthesizer studios of 1970s London on one side, and the 1979 home-computer hobbyist reading BYTE on the other.
Timeline
Notable Uses & Legacy
BYTE magazine (July 1979)
The article was written to show how a language works inside. It printed a complete Mouse interpreter as Pascal and explained how to turn it into assembly or machine code for any microcomputer, so readers could build their own
Mouse: A Language for Microcomputers (Petrocelli Books, 1983)
Grogono's book-length treatment of the language. Much of it walks through two full interpreter implementations, one in Pascal and one in Z80 assembly language, which makes it a worked case study in interpreter construction
CP/M Mouse interpreter
A small CP/M interpreter based on the book's Z80 version, updated by Lee R. Bradley (its banner reads "MOUSE, Peter Grogono, 1983; Lee Bradley, 2007"), which reportedly circulated in CP/M software archives
Mouse-2002 (David G. Simpson)
A modern extension of Mouse-83 that adds floating-point numbers, arrays, file I/O, global variables, an else operator and an interactive mode. It is distributed as C source with interpreters for the earlier dialects
MOUSE Programming Language project (SourceForge)
A community project, registered in 2001, that collects Mouse tools and promotes the language as an experimental and teaching language. It points to Sean Fuller's site "The Great MOUSE Programming Language Revival"