OATMEAL

From Esolang
Jump to navigation Jump to search

OATMEAL (Oat-Activated Tape-based Multiprogramming Engine At Last) is a programming language by User:BoundedBeans which prides itself on also being a short notation for oatmeal platters (You know, if you're having guests over and you want to serve them all oatmeal, but you want each bowl to be different...). It's based on a dream the author had in vivid detail.

Semantics

There is a tape of unbounded positive integers, but it has limited size at a time. The size can increase, but it starts out with zero cells. Cells must be inserted before anything is done. There is a data pointer, which can be on any cell, as well as directly after the last cell or directly before the first cell. If there are zero cells, there is only one place, which is where the first cell would go. When a cell is inserted, the pointer is placed on the new cell. There is also an instruction pointer.

Oatmeal

Each cell corresponds to a bowl of oatmeal. All new oatmeal bowls should start out empty. Any spoonfuls added should contain only oats and either milk or water, depending on preference, unless otherwise indicated by a cooking comment. The integer doesn't necessarily have any relation to what's in the bowl, but how it got there does. The data pointer, on the other hand, always corresponds to which bowl the cook is modifying. If the data pointer is after the last cell or before the first, the cook should not be modifying any bowl, except if a cell is inserted there, where the cook should make a new bowl of oatmeal and place it there. The instruction pointer has absolutely no relation; they start aligned, but any flow control instructions do not cause the cook to perform the flow control. The cook should always go instruction by instruction, always forwards, only making jumps when encountering semicolons or function calls.

Instructions

Character Computer instruction Cook instruction
> Move the data pointer right, wrapping from after the last cell to before the first cell. Move to the bowl to the right.
< Move the data pointer right, wrapping from before the first cell to after the last cell. Move to the bowl to the left.
^ Increment the current cell. Add an additional spoonful of basic oatmeal to the current bowl.
v Decrement the current cell. If it is already zero, no-op. Take a spoonful out of the oatmeal. If it is already empty, no-op. You can do whatever you would like with this spoonful, including:
  • Eating it
  • Saving it to eat later
  • Saving it for later ^ commands
  • Serving it
  • Throwing it away
  • Burning it
  • etc.
" Insert a cell at the position, moving all cells to the right one position. This command must be preceded by the > command, so that it can be more accurate to the dream this esolang was based on. Make a new bowl of basic oatmeal and insert it here, moving all bowls to the right one position up.
' Go-to the current cellth ' command in the range of the deepest nested area between / and \ (one-based), unless it is zero, where it should go to the command after the \. Does not jump if it directly follows /. This can jump into a loop nested within the current loop. Add a handful of raisins to the current bowl.
/code\ Creates an area for the ' command to work. These can be nested. A good way to make loops is /'code!!'\. /: Add a teaspoon of cinnamon to the current bowl. \: Add a teaspoon of sugar to the current bowl.
! Logical not. Stir the current bowl for 15 seconds.
& Zero the current cell and add its value to all other cells. Take the bowl and divide it evenly between all other bowls.
; No-op. Works sort of like ' in code, but checks if there is any oatmeal in the current bowl. Also works with / and \.
? No-op. If there is oatmeal in the bowl, remove it. (This oatmeal should not be saved if there are any other ingredients in it, unless a cooking comment says which step to save it for.). If there is no oatmeal in the bowl, add a spoonful of oatmeal to it.
[@text@] No-op, but is a comment for the programmer. No-op.
[$text$] No-op. No-op, but is a comment for the cook.
: Delete the current cell. Serve, eat, throw away, or otherwise remove the bowl from the cooking process, never to return.
~ Receive a number from input, put it in the current cell. If before the first cell or after the last, no-op. If you're acting on a bowl and not off the tape, ask another person for their favorite number (You can add conditions to keep it reasonable.). Add that many spoonfuls to the bowl.
` Same as ~, but as a unicode character. Same as ~, but ask them for their favorite symbol. If it isn't in unicode, go through their list of second-favorite, third-favorite, fourth-favorite, etc. until you find a valid unicode character.
_ Output as a number. Refrigerate the current bowl for 30 seconds.
- Output as a unicode character. Microwave the current bowl for 30 seconds.
% Mark the current cell as read-only. If it is already read-only, make it modifiable. Mark the current bowl as read only. If it is already read-only, make it modifiable.
{@text@code@} Defines a function with a name and contents. Defines a function for the cook to execute.
=@text= Calls the function with the specified name. The chef should execute the function. Chefs do have a call stack, but because their jump instructions are different and there could be function calls between them, chefs may end up with a separate path for the call stack to follow.
=$text= Imports the functions from another OATMEAL code file. The chef should grab the recipe from the other file and remember that the functions in that file might be used in the recipe.
=$$text= Executes the text as a command in the command-line. Temporarily halts execution until the command finishes. This allows command-line arguments. \cell(position)\ will be replaced with the number of the cell, while \ccell(position)\ will be replaced with the character. No-op.
. Reserved to allow two future or custom commands to share the same character.

Examples

Add two numbers of input

[$ Requires 4 bowls. $]
>"<>"<~>~>">"<<<<%>&>/'v>&<<v<%^%>&>!!'\<<_

Print Hi

[$ Requires 4 bowls. $]
>">">">">>>^^^^^^^^>%>/'v>&<<v<%^^^^^^^^^%>&>!!'\<<vvvvvvvvv-!v>!v>!v>!v>>>^^^^^^^^^^>%>/'v>&<<v<%^^^^^^^^^^%>&>!!'\<<vvvvv-