Mod articles
-
Stack based (RPN, similar in concept to the likes of Forth and PostScript), 26 variables, if statements, while loops
Based on the Mouse programming language by Peter Grogono
https://en.wikipedia.org/wiki/Mouse_(programming_language)
RobCo MOUSE differs from official specifications, some features are omitted, there are several new symbols and some symbols have a different meaning.
Language symbols:
Mathematical operators:
These require two values to be present on the stack (n1 and n2)
+ - add - n1 + n2
- - subtract - n1 - n2
* - multiply - n1 * n2
- divide - n1 / n2
% - modulo - n1 % n2
# - random number between n1 (inclusive) and n2 (non-inclusive)
Data manipulation:
&l... -
Max filesize: 984 bytes, max filename length: 20 characters
Command line commands:
catalogue - file directory
catalogue <string> - file directory, show filenames containing string
cls - clear screen
delete <filename> - delete file
exec <filename> - execute program file
exit - quit interface
help - show list of commands
new <filename> - open editor for a new file
type <filename> - print out full contents of a file
ver - print out version string
Command line can also be used for immediate code execution.
Editor commands:
save - quits editor and saves file with filename given in new command
discard - quits editor without saving
rmline -... -
Example programs in RobCo MOUSE
{ HELLO WORLD }
"Hello, world!" { COULDN'T BE EASIER }
{ ADD UP TWO NUMBERS }
"Number 1: " ? A: { PRINT PROMPT AND GET INTEGER, STORE IT IN "A" }
"Number 2: " ? B: { DITTO, BUT STORE IN "B" }
A. ! " + " B. ! " = " { PRINT OUT EQUATION IN THE FORM OF A + B = }
A. B. + { LOAD UP VALUES FROM VARIABLES AND ADD THEM UP }
! { PRINT OUT TOP OF THE STACK AS INTEGER }
{ SQUARES OF NUMBERS BETWEEN 1 AND 10 }
1 N: { STORE 1 IN "N" }
( { START OF LOOP }
N. @ * ! _ { LOAD VALUE OF "N" TO STACK, DUPLICATE TOP OF THE STACK AND MULTIPLY, THEN PRINT }
N. 10 < ^ { IF "N" IS LESS THAN 10, ...