# TMMLPTEALPAITAFNFAL

**TMMLPTEALPAITAFNFAL** (*The Multi-Million Language Project To End All Language Projects And Isn't That A Fine Name For A Language*) is an esoteric programming language devised by Gerson Kurz. Actually, it is not only one language; it is a new language for each day. Based on a unique-day-index (relative to January 1, 1900) a new allowed set of commands and arbitrary limits for variable names take place. However the syntax of the language does not change and looks mostly like some BASIC dialect. For example, on August 16, 2004, the following rules applied:

VALID TMMLPTEALPAITAFNFAL INSTRUCTIONS FOR TODAY: - GOTO - STOP - RETURN - ADD - SUB - MUL - DIV - IF-THEN-UNLESS - COPY - WRITE - READ - DECLARATION - WHILE-DO-PROVIDED - UNLESS-DO - REPEAT-UNLESS - DO-UNTIL - DO-UNLESS - NAND RESTRICTIONS ON IDENTIFIERS FOR TODAY: IDENTIFIER CHARACTERS MUST BE IN ASCII RANGE 32 .. 75 (' ' .. 'K')

## Data storage

There are an infinite number of cells. The cells can be given names with the DECLARE instruction; however, they must adhere to the RESTRICTIONS ON IDENTIFIERS. Alternatively, you can simply use a cell index (e.g. `CELL 0`

). The cells each have the storage of a `long`

.

## Instructions

Note that not all instructions are available on all days.

Instruction | Explanation | Availability |
---|---|---|

GOTO | Jumps to the given line number | Exactly one of this and GOSUB will be allowed. |

GOSUB | Calls the subroutine at the given line number | Exactly one of this and GOTO will be allowed. |

STOP | Ends the program. | Always allowed. |

RETURN | Returns from the current subroutine. If there is none, acts like STOP. | Always allowed. |

ADD | Adds the given values together. | Always allowed. |

SUB | Subtracts the given values. | Always allowed. |

MUL | Multiplies the given values together. | Always allowed. |

DIV | Divides the given values, rounding down. Results in the error "HEY, DIVISION BY ZERO IS A VERY BAD IDEA" if the divisor is 0. | Exactly one of this and MOD will be allowed. |

MOD | Takes the modulus of the given values. Results in the error "HEY, MODULO ZERO IS A VERY BAD IDEA" if the divisor is 0. | Exactly one of this and DIV will be allowed. |

IF-THEN | Runs the statement if the given condition is true. | At least one of this and the other control structures is allowed. |

IF-THEN-ELSE | Runs the first statement if the given condition is true; otherwise runs the second statement. | At least one of this and the other control structures is allowed. |

IF-THEN-UNLESS | Runs the statement if the first condition is true and the second condition is false. | At least one of this and the other control structures is allowed. |

IF-THEN-PROVIDED | Runs the statement if the first condition and the second condition are both true. | At least one of this and the other control structures is allowed. |

COPY | Copies the value to the given cell. | Always allowed. |

WRITE | Outputs a character or a number. | Always allowed. |

READ | Gets input as a character or a number. | Always allowed. |

DECLARE | Declares a name for a cell. | Always allowed. |

WHILE-DO | Runs the statement while the condition is true. | At least one of this and the other control structures is allowed. |

WHILE-DO-UNLESS | Runs the statement while the first condition is true and the second condition is false. | At least one of this and the other control structures is allowed. |

WHILE-DO-PROVIDED | Runs the statement while the first condition and the second condition are both true. | At least one of this and the other control structures is allowed. |

UNLESS-DO | Acts the same as UNTIL-DO. | At least one of this and the other control structures is allowed. |

REPEAT-UNTIL | Acts the same as DO-UNTIL. | At least one of this and the other control structures is allowed. |

REPEAT-UNLESS | Acts the same as UNTIL-DO. | At least one of this and the other control structures is allowed. |

DO-WHILE | Acts like a do-while loop while the condition is true. | At least one of this and the other control structures is allowed. |

DO-UNTIL | Acts like a do-while loop while the condition is false. | At least one of this and the other control structures is allowed. |

DO-UNLESS | Acts the same as UNTIL-DO. | At least one of this and the other control structures is allowed. |

UNTIL-DO | Runs the statement while the condition is false. | At least one of this and the other control structures is allowed. |

NAND | Sets the output to 0 if both inputs are -1, otherwise to 1. | Always allowed. |

## Errors

- The arithmetic instructions must have the destination value on the right. If it's not a cell, results in an error "ERROR, ARITHMETIC INSTRUCTION MUST HAVE MEMORY TARGET, STUPID!"
- READ must have a cell value as the destination. If it doesn't, results in an error "ERROR, READ INSTRUCTION MUST HAVE MEMORY TARGET, STUPID!"
- NAND must have the destination value on the right. If it's not a cell, results in an error "ERROR, NAND INSTRUCTION MUST HAVE MEMORY TARGET, STUPID!"

## Syntax

Taken from the official page, with some formatting changes and corrections.

**STATEMENT**: [LINE_NUMBER] CONTROL_LOGIC | MATH_STATEMENT | IO_STATEMENTS | DECLARATION

**DECLARATION**: "DECLARE" NUMERIC "AS" NAME

**NAME**: NC (NC | DECINT)*

**NC**: <non-numeric printable ASCII char>

**CONTROL_LOGIC**: BRANCH_STATEMENT | IF_FAMILY | WHILE_FAMILY

**IF_FAMILY**: IF_THEN | IF_THEN_ELSE | IF_THEN_UNLESS | IF_THEN_PROVIDED

**WHILE_FAMILY**: WHILE_DO | WHILE_DO_UNLESS | WHILE_DO_PROVIDED | UNLESS_DO | REPEAT_UNTIL | REPEAT_UNLESS | DO_WHILE | DO_UNTIL | DO_UNLESS | UNTIL_DO

**IF_THEN**: "IF" BOOLEAN_EXPRESSION "THEN" STATEMENT

**IF_THEN_ELSE**: "IF" BOOLEAN_EXPRESSION "THEN" STATEMENT "ELSE" STATEMENT

**IF_THEN_UNLESS**: "IF" BOOLEAN_EXPRESSION "THEN" STATEMENT "UNLESS" BOOLEAN_EXPRESSION

**IF_THEN_PROVIDED**: "IF" BOOLEAN_EXPRESSION "THEN" STATEMENT "PROVIDED" BOOLEAN_EXPRESSION

**WHILE_DO**: "WHILE" BOOLEAN_EXPRESSION "DO" STATEMENT

**WHILE_DO_UNLESS**: "WHILE" BOOLEAN_EXPRESSION "DO" STATEMENT "UNLESS" BOOLEAN_EXPRESSION

**WHILE_DO_PROVIDED**: "WHILE" BOOLEAN_EXPRESSION "DO" STATEMENT "PROVIDED" BOOLEAN_EXPRESSION

**UNLESS_DO**: "UNLESS" BOOLEAN_EXPRESSION "DO" STATEMENT

**UNTIL_DO**: "UNTIL" BOOLEAN_EXPRESSION "DO" STATEMENT

**REPEAT_UNTIL**: "REPEAT" STATEMENT "UNTIL" BOOLEAN_EXPRESSION

**REPEAT_UNLESS**: "REPEAT" STATEMENT "UNLESS" BOOLEAN_EXPRESSION

**DO_WHILE**: "DO" STATEMENT "WHILE" BOOLEAN_EXPRESSION

**DO_UNTIL**: "DO" STATEMENT "UNTIL" BOOLEAN_EXPRESSION

**DO_UNLESS**: "DO" STATEMENT "UNLESS" BOOLEAN_EXPRESSION

**IO_STATEMENTS**: READ | WRITE

**WRITE**: "WRITE" ("CHAR" | "INTEGER") NUMERIC

**READ**: "READ" ("CHAR" | "INTEGER") NUMERIC

**BOOLEAN_EXPRESSION**: NUMERIC [(">" | "<" | "=" | "<>" | ">=" | "<=") NUMERIC]

**MATH_STATEMENT**: ADD | SUB | MUL | MOD | DIV | COPY | NAND

**ADD**: "ADD" NUMERIC "TO" NUMERIC

**COPY**: "COPY" NUMERIC "TO" NUMERIC

**SUB**: "SUB" NUMERIC "FROM" NUMERIC

**MUL**: "MUL" NUMERIC "WITH" NUMERIC

**NAND**: "NAND" NUMERIC "WITH" NUMERIC

**MOD**: "MOD" NUMERIC "BY" NUMERIC

**DIV**: "DIV" NUMERIC "BY" NUMERIC

**NUMERIC**: NAME | INTEGER | "CELL" INTEGER ["INDIRECT"]

**BRANCH_STATEMENT**: GOTO | GOSUB | STOP | RETURN

**STOP**: "STOP"

**RETURN**: "RETURN"

**GOSUB**: "GOSUB" NUMERIC

**GOTO**: "GOTO" NUMERIC

**LINE_NUMBER**: "LINE" INTEGER ":"

**INTEGER**: DECINT (DECINT)*

**DECINT**: "0" .. "9"