# Grocery List

Jump to navigation
Jump to search

This language by User:PuzzleHunter84 takes the form of a grocery list. Each food item does a certain function depending on the first letter of the item.

Letter | Function |
---|---|

a | pops the top two values on the stack, adds them together and pops the result. |

b | brings the bottom stack value to the top. |

c | copies the top value of the stack on top of the stack. |

d | pops the top two values on the stack, divides the second-to-the-top into the top, and pushes the result rounding down if necesssary. |

e | ends a loop and rechecks the top value. |

f | flips the top two stack values so the top value becomes the second-to-top value and vice versa. |

g | pops the top two values, pushes 1 if the top value is greater than the second-to-top value and 0 otherwise. |

h | pops a value, takes the value mod 26, adds 1, finds the letter of the alphabet in that position, and executes the instruction of that letter. |

i | inputs a character and pushes it's ASCII value on top of the stack. |

j | pops the top value and jumps forward that many instructions. |

k | kills the stack, removing every value. |

l | opens a loop that runs if the top value is nonzero. |

m | pops the top two values on the stack, multiplies them together, and pushes the result. |

n | pushes a number onto the stack equal to the number of letters in this food item. |

o | pops the top value on the stack and outputs it as a numeral. |

p | pops the top value and prints it as an ASCII character. |

q | nop. |

r | pops the top two values on the stack, divides the second-to-the-top into the top, and pushes the remainder. |

s | pops the top two values on the stack, subtracts the second-to-the-top from the top, and pushes the result. |

t | terminates the program immediately. |

u | unbrings the top value to the bottom. |

v | take the next list item, does not execute it, and instead pushes the ASCII value of the first letter of the list item. |

w | pushes 100. |

x | pops the top value. |

y | pops the stack item that corresponds to the number of letters in this item. |

z | pops the top value, and pushes 1 if it is 0 and 0 otherwise. |

Each program starts with a title that is the store name and is ignored such as: "Hello World Marketplace". Then there is an empty line before the list. Each item is seperated by a new line.

## Programs

### Cat Program

Cat Groceryplace ice cream lettuce popcorn imported bisque eggs tunafish

This is equivalent to the BF program:

,[.,]

## Implementation

An interpreter in Python 3 that tries to follow the specification above as closely as possible can be found here.