Moed
Jump to navigation
Jump to search
Moed (pronounced /mid/) is an esoteric programming language by User:Dhzb.
Whitespace
Whitespace is sometimes significant.
Newlines
Newlines can be scoped inside of {...}
groups which can be targeted by newline-imperae.
Execution
Moed executes in a given direction which is initialized to 1 (right), the direction can be changed to other values by using one of three dexterimperae.
Data storage
Moed primarily uses the stack to store short-term data but also provides a secondary medium which is the matrix
Imperae
Currently, Moed has 2 types of imperae: Dexterimperae and Sinisterimperae. Each imperae has an associated symbol to represent it.
Dexterimperae
Symbol | Name | Description |
---|---|---|
0-9 | Digit | Pushes the corresponding digit onto the stack |
> | Right | Sets the direction of execution to 1 |
< | Left | Sets the direction of execution to -1 |
| | Mirror | Mirrors (by negating) the execution direction |
_ | Newline | Jumps to the next character of the next newline in the current scope |
" | Subnewline | Pops n and jumps to the next character of the next newline in the scope n levels up |
= | Skip | Skips over one execution step (including groups as one execution step) |
+ | Addition | Pops x and y and pushes x+y onto the stack |
- | Subtraction | Pops x and y and pushes x-y onto the stack |
* | Multiplication | Pops x and y and pushes x×y onto the stack |
/ | Division | Pops x and y and pushes x÷y onto the stack (0 divisor returns 0) |
% | Modulo | Pops x and y and pushes x mod y onto the stack (negative wraps around, 0 divisor returns 0) |
^ | Exponentiation | Pops x and y and pushes xy onto the stack |
\ | Swap | Swaps the top 2 values on the stack |
$ | Discard | Pops a value and discards it |
' | Character | Skips one execution step and pushes the character at the execution pointer onto the stack |
: | Duplicate | Duplicates the top value on the stack |
; | Duplicate | Pops n and duplicates the nth value from the top of the stack (starting at 0) to the top of the stack |
& | Incharacter | Gets a character from input |
? | Auxiliary incharacter | Gets a character from auxiliary input |
# | Innumber | Gets a number literal from input |
, | Outcharacter | Outputs a character from the stack (pop) |
. | Outnumber | Outputs a number literal from the stack (pop) |
` | Unvalencitudinity | If top of stack (don't pop) is nonzero, continue forwards, otherwise mirror+skip |
~ | Sinisterimpera toggle | Interpret the characters as sinisterimperae from now on |
@ | Stop | Halts the program execution |
(...) | Special | Does a special operation based on the first character in it and the rest of the string |
J | Jump | Pops n and jumps to the nth j relative to the current character |
I | Pause | Pauses execution |
R | Return | Returns to the previous location before a custom impera call |
Any other character | Call | Goes to the location associated with the character |
Sinisterimperae
Symbol | Name | Description |
---|---|---|
| | Set | Pops y, x, and v and sets the value at the corresponding position x,y in the matrix to v |
^ | Get | Pops y and x and pushes the value at the corresponding position x,y in the matrix onto the stack |
= | Skip | Does the same as it is as a dexterimpera except that it doesn't skip groups |
? | Random | Pushes a random number in the range [0,1) |
. | Floor | Applies a floor function on the top value on the stack |
: | Ceiling | Applies a ceiling function on the top value on the stack |
; | Round | Applies a round function on the top value on the stack |
~ | Dexterimpera toggle | Interpret the characters as dexterimperae from now on |
Any other character | Does nothing |
Special operations
First character | Description |
---|---|
" | Pushes the rest of the string onto the stack starting from the end of the string |
& | Prints the rest of the string |
= | Associates a location (after the '=') with the popped character on the stack |
Any other character | Does nothing |
Examples
Computational class
User:Dhzb has created a brainfuck interpreter in Moed, therefore, Moed is turing-complete
Implementation
Future additions
- [✓] Custom operations (e.g.
'√(=21/\^)
) -- now'√(=21/\^R)
- [✓] Pause execution