Mention
Jump to navigation
Jump to search
Mention is a programming language created by User:PKMN Trainer.
Syntax
Instructions are written like this (Operands may not be in the instruction):
(instruction symbol) (operand1) (operand2)(end instruction indicator)
Operands may be instructions; however, a variable command can only have one operand if it is an operand. Immediates in Mention are written in binary.
The following symbols are used to end an instruction.
- Newline
- Semicolon (;)
- Dot (.)
- Slash (/)
Mention has 6 instructions.
Command | Description | Followed by | Example | Psuedocode |
---|---|---|---|---|
v | Defines and/or mentions variable | 1 or 2 operands | v 0 1; v 0 | v0 = 1; mention.append(v0) |
- | Contains the difference between the last two mentioned variables | 0 operands | v 0 - | v0 = mention[len(mention)-1) - mention[len(mention)-2] |
i | Contains input | 0 operands | v 0 i | v0 = input |
o | Outputs the last mentioned variable. If the next operand is 0, it is output as a number; otherwise, it is output as a character. | 1 operand | v 0; o 0 | mention.append(v0); output_num(mention[len(mention)-1]) |
* | When next to a variable, it changes the variable's meaning to the nth character of code (n is the value of the variable) | 1 operand | v 0 *v 1 | v0 = nth_char_of_code(v1) |
B | Branches to the line corresponding to the value of the operand if the last mentioned variable is 0 or less. | 1 operand | v 0 0; B 0 | v0 = 0; if v0 <=0 {goto v0} |
Programs
Hello World Program
v 0 01001000 // H o 1 v 1 01100101 // e o 1 v 10 01101100 // l o 1 o 1 v 11 01101111 // o o 1 v 100 00100000 // space o 1 v 101 01010111 // W o 1 v 11 // o o 1 v 110 01110000 // r o 1 v 10 // l o 1 v 111 01100100 // d o 1
Truth-machine
v 0 i o 0 B 7 v 0 1 o 0 v 1 0 B 3
Cat
v 0 i o 0 B 5 v 1 0 B 0
Infinite loop
B 0
Adder
v 0 i v 1 0 v 10 i v 1 - v 0 v 1 v 10 - o 0
Computational class
Currently, Mention is presumed to be Turing Complete as the commands v, -, and B can be used to replicate a Subleq instruction, which is Turing Complete. Catergory:Turing complete