MICE

From Esolang
Jump to navigation Jump to search

Overview

MICE (which stands for MICE Interprets Concise English) is an esoteric programming language created by nullbyte00 that is meant to be very easy to program in (which is unusual as most esolangs are meant to be very hard to program in), and meant to look like English. The language is not complete yet, however there is a working interpreter that can do basic things.

Commands

The following was copied from the README. If something is not followed by "(not complete)" then it will work in the interpreter.

Create a variable:
	-Create a variable called varname. (Creates an empty variable)
	-Create a variable called varname with the value of varvalue. (Creates a variable with specified value)

Output:
	-Output the text "Hello World". (Outputs text)
	-Output the number 55. (Outputs a number)
	-Output the variable varname. (Outputs a variable)

Input:
	-Accept input from the user and store it in the variable varname. (Gets input from user and stores in var)

Arithmetic:
	-Subtract x from varname. (Subtracts x from varname, then puts the new value in varname)
	-Add x to varname. (Adds x to varname, then puts the new value in varname)
	-Multiply varname by x. (Multiplies x by varname, then puts the new value in varname)
	-Divide varname by x. (Divides varname by x, then puts the new value in varname)
	-Raise varname to the x power. (Raises varname to the x power, and stores the new value in varname)

Return values:
	-X minus Y.
	-X plus Y.
	-X times Y.
	-X divded by Y.
	-X to the Y power.
	-X remainder Y.

While loop:
	-While the variable varname is not equal to the number 5 plus the number 6, then do the following: ... Then end the block.

Conditional:
	If the variable varname is equal to the text "String", then do the following: ... Then end the block.

Subroutine:
	-Create a subroutine called subname that does the following: ... Then end the block.

Returning: (not complete)
	-Return the text "Hello World".

Calling functions: (not complete)
	-...the subroutine subname.

In a non-return usage:
	-Perform the subroutine subname.

Concatenation:
	-...and...

File I/O: (not complete)
	-...the file 'name.txt'.
	-Write the text "Hello World" to the file 'name.txt';

Examples

All of the following examples work in the current interpreter.

Hello, World!

Output the text "Hello, World!".

99 Bottles of Beer

Create a variable called bottle with the value of 99.
While the variable bottle is greater than 0, then do the following:
Output the variable bottle and the text " bottles of beer on the wall, " and the variable bottle and the text " bottles of beer!". 
Subtract 1 from bottle.
Output the text " Take one down, pass it around, " and the variable bottle and the text " bottles of beer on the wall!" and a newline.
Then end the block.

Fibonacci Numbers

Create a variable called lastnum with the value of 1.
Create a variable called verylastnum with the value of 0.
Accept input from the user and store it in the variable howmany.
Subtract 2 from howmany.
Output the text "0, 1".
While the variable howmany is greater than the number 0, then do the following:
Create a variable called sum with the value of the variable lastnum plus the variable verylastnum.
Create a variable called verylastnum with the value of the variable lastnum.
Create a variable called lastnum with the value of the variable sum.
Output the text ", " and the variable sum.
Subtract 1 from howmany.
Then end the block.
Output a newline.

Prime Number Generator

Create a variable called itr with the value of 3.
Output the text "Which number do you want to generate all prime numbers up to? ".
Accept input from the user and store it in the variable howmany.
Add 1 to howmany.
Output the number 2.
While the variable itr is less than the variable howmany, then do the following:
Create a variable called remndr with the value of the variable itr remainder 2.
If the variable remndr is not equal to the number 0, then do the following:
Output the text ", " and the variable itr.
Then end the block.
Add 1 to itr.
Then end the block.
Output a newline and a newline.

Cat Program

While true, then do the following:
Accept input from the user and store it in the variable inpt.
Output a newline and the variable inpt and a newline.
Then end the block.

External resources