MOUSE

Computer Programming Language

 
Home
Mouse-79
Mouse-83
Mouse-2002
Contact Me

David Simpson
   

MOUSE-2002 REFERENCE

 Symbol 
 Function   Description 
 <blank> 
 -   No action. 
 $ 
 Program terminator.   Exit. 
 <number> 
 Number.   Push a number onto the stack. 
 + 
 Add.   Pop two operands from the stack and push their sum. 
 - 
 Subtract.   Pop two operands from the stack and push their difference. 
 * 
 Multiply.   Pop two operands from the stack and push their product. 
 / 
 Divide.   Pop two operands from the stack and push their quotient. 
 \ 
 Remainder.   Pop two operands from the stack and push the remainder of the first divided by the second. 
 ? 
 Input number.   Read a number from the keyboard and push it onto the stack. 
 ?' 
 Input character.   Read a character from the keyboard and push its ASCII code onto the stack. 
 ! 
 Output number.   Pop a number from the stack and display it on the terminal. 
 !' 
 Output character.   Pop an ASCII code from the stack and display the corresponding character on the terminal. 
 '<char> 
 Character literal.   Push the ASCII code corresponding the the character onto the stack. 
 " 
 Output string.   Display each character between the " and the next " on the terminal. Translate the character ! to <new-line>. 
 <letter> 
 Variable.   Convert the letter to an integer in the range 0..25 (A=a=0, B=b=1,...,Z=z=25). 
 : 
 Assignment.   Pop two operands from the stack and store the value of the second at the address specified by the first. 
 . 
 Dereference.   Pop an address from the stack and push the value stored at that address onto the stack. 
 < 
 Comparison.   Pop two operands from the stack. If the first is less than the second, push 1, else push 0 onto the stack. 
 = 
 Comparison.   Pop two operands from the stack. If they are equal, push 1, else push 0 onto the stack. 
 > 
 Comparison.   Pop two operands from the stack. If the first is greater than the second, push 1, else push 0 onto the stack. 
 [ 
 Conditional.   Pop a value from the stack. If it is zero or negative, skip over the character until a matching ] is found. 
 ] 
 -   No action. 
 | 
 Else.   "Else" clause of a conditional statement. 
 ( 
 Start loop.   No action. 
 ) 
 Go back to top of loop.   Go back to top of loop. 
 ^ 
 Exit loop.   Exit loop. 
 #<letter> 
 Macro call.   Macro call. 
 @ 
 Exit from macro.   Exit from macro. 
 % 
 Replace formal parameter by actual.   Replace formal parameter by actual. 
 , 
 End of actual parameter.   End of actual parameter. 
 ; 
 End of actual parameter.   End of actual parameter. 
 { 
 Switch on tracing.   Switch on tracing. 
 } 
 Switch off tracing.   Switch off tracing. 
 ~ 
 Comment.   Start of comment. 
 _ 
 Change sign.   Change the sign of X. 
 & 
 Function.   Execute built-in function (see table below). 

Ampersand Functions

FunctionDescription
 &2X  Computes 2**x. 
 &4TH  Computes the fourth power of x. 
 &4THRT  Computes the fourth root of x. 
 &10X  Computes 10**x. 
 &ABS  Computes the absolute value of x. 
 &ACOS  Computes the inverse cosine of x. The units of the result (deg, rad, grad, rev) depends on the current angle mode setting (see &DEG, &RAD, &GRAD, &REV). 
 &ACOSH  Computes the inverse hyperbolic cosine of x. 
 &AND  Computes the bitwise logical AND of x and y. 
 &ASIN  Computes the inverse sine of x. The units of the result (deg, rad, grad, rev) depends on the current angle mode setting (see &DEG, &RAD, &GRAD, &REV). 
 &ASINH  Computes the inverse hyperbolic sine of x. 
 &ATAN  Computes the inverse tangent of x. The unints of the result (deg, rad, grad, rev) depends on the current angle mode setting (see &DEG, &RAD, &GRAD, &REV). 
 &ATAN2  Computes the inverse tangent of y/x, placing the result in the correct quadrant. The units of the result (deg, rad, grad, rev) depends on the current angle mode setting (see &DEG, &RAD, &GRAD, &REV). 
 &ATANH  Computes the inverse hyperbolic tangent of x. 
 &AU  Returns the value of one astronomical unit of distance (AU) in meters to x. 
 &BEEP  Causes an audible beep at the terminal. 
 &C  Returns the value of the speed of light in vacuum (in meters per second) to x. 
 &CLRSTK  Clears the stack. 
 &CM>IN  Converts the length in x from centimeters to inches. 
 &CNR  Computes the number of combinations of y things taken x at a time. 
 &CONT  Continue to end of loop. 
 &COS  Computes the cosine of the angle in x. The units of x are assumed to be that given by the current angle mode setting (deg, rad, grad, or rev). (See &DEG, &RAD, &GRAD, &REV). 
 &COSH  Computes the hyperbolic cosine of x. 
 &CUBE  Computes the cube of x. 
 &CUBERT  Computes the cube root of x. 
 &C>F  Converts the temperature in x from degrees Celsius to degrees Fahrenheit. 
 &DEG  Sets the current angle mode to degrees (the default). 
 &DOM  Returns the current day of month (1-31) to x. 
 &DOW  Returns the current day of week (1-7) to x. Here 1=Sunday, 2=Monday, 3=Tuesday, ..., 7=Saturday. 
 &DOY  Returns the current day of year (1-366) to x. 
 &DROP  Drops x from the top of the stack. All other stack entries drop by 1 accordingly. (x -- ) 
 &DUP  Duplicates the number in x to x and y. (x -- x x) 
 &D>R  Converts the angle in x from degrees to radians. 
 &E  Returns the value of the elementary charge (in coulombs) to x. 
 &EEX  Computes y * 10**x. This is meant to be used to allow constants to be entered in a program in scientific notation. For example, -1.23e-45 would be entered as 1.23_ 45_ &eex 
 &EPS0  Returns the value of the permittivity of free space (in F/m) to x. 
 &EXIT  Exits Mouse interactive mode and returns to the operating system. (Same as &QUIT.) 
 &EXP  Computes exp(x). 
 &FACT  Computes x factorial.
 &FCLOSE  Closes a file. Use as: n &FCLOSE where n is the file ID. 
 &FEOF  Returns 1 if end of file, and 0 otherwise. Use as: n &FEOF where n is the file ID. 
 &FIX  Specifies output to be displayed in "fixed" mode, to the number of decimal places specified by x. 
 &FOPEN  Opens a file. Use as: n mode &FOPEN where n is the file ID and "mode" is the file mode: mode = 0: read ASCII 1: write ASCII 2: read binary 3: write binary The file will be given a name "mouse.nnn", where nnn is the three-digit file ID. 
 &FREWIND  Rewind a file to the beginning. Use as: n &FREWIND where n is the file ID. 
 &FRAC  Returns the fractional part of x. 
 &F>C  Converts the temperature in x from degrees Fahrenheit to degrees Celsius. 
 &F?  Read a floating-point number from a file and push its value onto the stack. Use as: n &F? where n is the file ID. 
 &F?'  Read a character from a file and push its value onto the stack. Use as: n &F?' where n is the file ID. 
 &F!  Pop an operand from the stack and print its value to a file. Use as: n &F! where n is the file ID. 
 &F!'  Pop an operand from the stack and print the corresponding ASCII character to a file. Use as: n &F!' where n is the file ID. 
 &F"  Print each character following the space following &F" and the next " to a file. Translate the character ! to . Use as: n &F" where n is the file ID. 
 &G  Returns the universal gravitational constant G (in m**3 kg**-1 s**-2) to x. 
 &G0  Returns the standard acceleration due to gravity (in m/s**2) to x. 
 &GAL>L  Converts the volume in x from gallons to liters. 
 &GE  Returns 1 if y >= x, and 0 otherwise. 
 &GEN  Specifies output to be in "general" mode, to the number of digits specified by x. 
 &GMEARTH  Returns the universal gravitational constant G times the mass of the Earth (m**3 s**-2) to x. 
 &GMSUN  Returns the universal gravitational constant G times the mass of the Sun (m**3 s**-2) to x. 
 &GRAD  Sets the current angle mode to grads. 
 &H  Returns Planck's constant (in J s) to x. 
 &HALFPI  Returns the value of pi/2 to x. 
 &HBAR  Returns Planck's constant divided by 2*pi (in J s) to x. 
 &HMS>H  Converts a time or angle of the form HH.MMSS in x to decimal hours or degrees. 
 &HOUR  Returns the hour of the current clock time (0-23) to x. 
 &H>HMS  Converts a time or angle in decimal form in x to the form HH.MMSS. 
 &INT  Replaces x with the integer part of x. 
 &IN>CM  Converts the length in x from inches to centimeters. 
 &KB  Returns Boltzmann's constant (in J/K) to x. 
 &KG>LB  Converts the mass in x from kilograms to pounds. 
 &LB>KG  Converts the mass in x from pounds to kilograms. 
 &LE  Returns 1 if y <= x, and 0 otherwise. 
 &LN  Computes the natural logarithm of x. 
 &LOG  Computes the natural logarithm of x. 
 &LOG2  Computes the base 2 logarithm of x. 
 &LOG10  Computes the base 10 logarithm of x. 
 &L>GAL  Converts the volume in x from liters to gallons. 
 &ME  Returns the mass of the electron (in kg) to x. 
 &MIN  Returns the minute of the current clock time (0-59) to x. 
 &MN  Returns the mass of the neutron (in kg) to x. 
 &MONTH  Returns the current month (1-12) to x. 
 &MP  Returns the mass of the proton (in kg) to x. 
 &MU0  Returns the permeability of free space (in N A**-2) to x. 
 &NA  Returns Avagadro's number to x. 
 &NE  Returns 1 if y != x (y not equal to x), and 0 otherwise. 
 &NIP  Drops y from the stack, leaving x. (y x -- x) 
 &NOT  Computes the bitwise logical NOT of x. 
 &OR  Computes the bitwise logical OR of x and y. 
 &OVER  Copies y to the top of the stack. (y x -- y x y) 
 &PI  Returns the value of pi to x. 
 &PNR  Computes the number of permutations of y thing taken x at a time. 
 &POW  Computes y to the x power. 
 &P>R  Converts polar to rectangular coordinates. Initially the angle (theta) is in y, and magnitude r is in x. After &P>R executes, y will be in y, and x will be in x. The angle theta is assumed to have units given by the current angle mode setting (deg, rad, grad, or rev). (See &DEG, &RAD, &GRAD, &REV.) 
 &QUIT  Exits Mouse interactive mode and returns to the operating system. (Same as &EXIT.) 
 &RAD  Sets the current angle mode to radians. 
 &RAND  Returns a random number between 0 and 1 to x. 
 &RCL  Recalls array element x to the stack. 
 &REARTH  Returns the equatorial radius of the Earth (in meters) to x. 
 &RECIP  Computes the reciprocal of x. 
 &REV  Sets the current angle mode to revolutions. 
 &ROOT  Computes the x-th root of y. 
 &ROT  Rotates "up" the first three elements on the stack. (z y x -- y x z) 
 &ROUND  Rounds x to the nearest integer. 
 &R>D  Converts the angle in x from radians to degrees. 
 &R>P  Converts rectangular to polar coordinates. Initially y will be in y, and x will be in x. After &R>P executes, the angle theta will be in y, and the magnitude r will be in x. The angle theta will be given in units specified by the current angle mode (deg, rad, grad, or rev). (See &DEG, &RAD, &GRAD, &REV.) 
 &SCI  Specifies output to be in scientific notation, with the number of decimal places specified by x. 
 &SEC  Returns the second of the current clock time (0-59) to x. 
 &SEED  Stores integer seed (in x) for random numbers. (See &RAND.) To use the system clock as the seed, use: &TIME &SEED 
 &SHL  Returns y shifted left by x bits. 
 &SHR  Returns y shifted right by x bits. 
 &SIN  Computes the sine of the angle in x. The units of x are assumed to be that given by the current angle mode setting (deg, rad, grad, or rev). (See &DEG, &RAD, &GRAD, &REV). 
 &SINH  Computes the hyperbolic sine of x. 
 &SQR  Computes the square of x. 
 &SQRT  Computes the square root of x. 
 &STO  Stores y into array element x. 
 &SWAP  Swaps x and y. (y x -- x y) 
 &TAN  Computes the tangent of the angle in x. The units of x are assumed to be that given by the current angle mode setting (deg, rad, grad, or rev). (See &DEG, &RAD, &GRAD, &REV). 
 &TANH  Computes the hyperbolic tangent of x. 
 &TIME  Returns the system time as an integer. 
 &TUCK  Copies x to z. (y x -- x y x) 
 &TWOPI  Returns the value of 2*pi to x. 
 &VER  Prints the current Mouse version. 
 &WIDTH  Set printing width. (n -- ) 
 &WSIZE  Sets the octal/hexadecimal words size to x bits. 
 &XOR  Computes the bitwise logical exclusive OR of x and y. 
 &Y2X  Computes y * 2**x. 
 &YEAR  Returns the current year to x. 
 &?HEX  Reads a hexadecimal number from the terminal and places in on the top of the stack. 
 &?OCT  Reads an octal number from the terminal and places in on the top of the stack. 
 &!DEC  Prints x as an integer on the terminal in decimal format, with leading zeros. The field width is determined by the current setting of &WIDTH. 
 &!HEX  Prints x on the terminal in hexadecimal format. 
 &!OCT  Prints x on the terminal in octal format. 
 &!STK  Prints the stack. 


Contact Information

I may be contacted at:
 

Copyright © 2006 David G. Simpson

http://Mouse.DavidGSimpson.com

Webmaster: David G. Simpson
Page last updated: February 8, 2007.