Content deleted Content added
thumbnailed and repositioned book graphic |
m →External links: HTTP to HTTPS for SourceForge |
||
(39 intermediate revisions by 31 users not shown) | |||
Line 1:
{{Short description|Programming language}}
The '''Mouse'''
Mouse was originally intended as a small, efficient language for [[microcomputer
The elements of the Mouse language consist of a set of (mostly) one-character symbols, each of which performs a specific function (see table below). Since variable names are limited to one character, there are only 26 possible variables in Mouse (named A-Z). Integers and characters are the only available data types.
Despite these
* Conditional branching
Line 14 ⟶ 15:
* Code tracing
The design of the Mouse language makes it ideal for teaching the design of a simple interpreter. Much of the book describing Mouse<ref name="grogono2" /> is devoted to describing the implementation of two interpreters, one in [[Z80]] [[
==
The language described here is the later version of Mouse, as described in the Mouse book.<ref name="grogono2" />
▲The language described here is the later version of Mouse, as described in the Mouse book<ref name="grogono2" />. This version is an extension of the language described in the original magazine article<ref name="grogono1" />.
The following table describes each of the symbols used by Mouse.<ref name="grogono2" />
{| class="wikitable"
! Symbol
! Action
|-
|align="center"| <space>
▲===Mouse Symbols===
▲The following table describes each of the symbols used by Mouse<ref name="grogono2" />. Here X refers to the number on the top of the stack, and Y is the next number on the stack.
| No action
|-
Line 136 ⟶ 127:
|}
===
====Common Idioms====▼
These expressions appear frequently in Mouse programs.
Line 145 ⟶ 135:
X: ~ store into variable X
X. ~ recall variable X
X. Y: ~
N. 1 + N: ~ increment N by 1
P. Q. P: Q: ~ swap values of P and Q
Line 153 ⟶ 143:
====Input====
Mouse may input integers or characters. When a character is input, it is automatically converted to its ASCII code.
<pre>
Line 171 ⟶ 160:
====Conditionals====
A conditional statement has the general form:
<pre>
Line 179 ⟶ 167:
====Loops====
Loops may have one of several forms. Most common are the forms:
<pre>
Line 187 ⟶ 174:
Here again ''B'' is a boolean value (0 or 1), and ''S'' is a sequence of statements.
====Macro
The format of a macro (subroutine) call may be illustrated by the following example. Macro A in this example adds the two parameters passed to it from the main program, and returns the sum on the top of the stack.
Line 197 ⟶ 184:
Here ''p1'' and ''p2'' are parameters passed to the macro.
=== Example
This short program prints 'Hello world.'
<pre>
Line 212 ⟶ 198:
==Notes==
{{Reflist|2}}
==External links==
* [http://users.encs.concordia.ca/~grogono/Mouse/mouse.html The Mouse Programming Language]
* [https://web.archive.org/web/20070307145837/http://www.geocities.com/fullerhaparnoldafmil/mouse.html The Great MOUSE Programming Language Revival]
* [https://archive.today/20030506120304/http://cth.dtdns.net/mouse/ Friends of the Mouse]
* [http://primepuzzle.com/mouse/mouse.html Mouse, the Language]
* [http://mouse.davidgsimpson.com Mouse: Computer Programming Language] (includes source code for Mouse interpreters)
* [
{{Authority control}}
[[Category:Stack-oriented programming languages]]
|