Burger Place

From Esolang
Jump to navigation Jump to search
Burger Place
Paradigm(s) imperative
Designed by Daniel
Appeared in 2021
Memory system Stack-based
Dimensions one-dimensional
Computational class Unknown
Reference implementation Unimplemented
File extension(s)

Burger Place is an imperative stack-based esoteric programming language designed by Daniel (Sombrero64 / User:BarbecueBurrito). The language supports a wordy set of commands, as well a confusing semantics based on said commands. The programming language's inputs and outputs system is centered around costumer's, which are used during input generation and to display outputs back to the user after the program is finished.

Overview

All programs are made of four parts, the order (generates inputs and customers), the fridge (generates memory), the kitchen (modifies data and output information), and the dining room (displaying outputs). After all is defined, write lunchtime! at the end of your program. This runs each part of your program in order (order, fridge, kitchen, dining room), and everything after this command is ignored. All commands are categorized, and you can only use a command in their respective category. For example, a command instead for order generation cannot be used in the kitchen.

The dish infers to the value you are currently working on, and the top of infers to the last item of a stack, which is recursive if the last item of a stack happens to be another stack. For a stack to have a value, is to carry atleast one item. Stacks that has no items or has a null value is instead empty. Burger Place supports multiline comments with brackets, and tab indented code blocks.

Orders (Inputs)

The orders are the inputs and customers of your program. Although you can make a program without inputs and customers, you would be missing out of receiving user input, random numbers, and string outputs. orders for A to B (can only be used once) defines orders, and the two inputs are used to generate a random amount of order.

To add a new number to the current stack, use a number A (defines once) or A number Bs (defines multiple times). To generate a random number, use should i get a A or a B? / should i get an A or an B?. This adds a random number between A and B to the current stack.

orders for 1 to 1
 a number 2
 2 number 4s
 should i get a 2 or a 4?

i'll take defines a customer, with a substack to work with. To define a substack only, use a meal of. This command can be used outside or inside customer defining. To define a substack out the characters of a string, use that would be a A?. The command's substack contains numbers of each character ASCII's value, and adds said substack to the current stack.

orders for 1 to 1
 i'll take
  a number 2
 a meal of
  a number 2
 that would be a foo?
 that would be a bar?

To receive user input, use either what do you want? or what again?. The first one treats the input as a number, then adds said number to the current stack. The second one treats it as a string, and converts every character into a number. This adds a substack containing said numbers to the current stack.

orders for 1 to 1
 a meal of
  what do you want?
 what again?

Fridge (Memory)

The Fridge stores boxes (stacks or numbers) at a specific index (starting at one), and there's a limit on how many boxes are there. fridge of A is used to generate boxes and starting values of said boxes. The limit is determined by A (1 to A), and the command can only be used once. To update the default values of some boxes, use there's a A, there's an A, or there's A Bs. These commands sets the value of the first empty box with A once, or B by A times. To create a substack instead, use there's a bag of.

fridge of 3
 there's a 0
 there's a 2
 there's a bag of
  there's a 4
  there's 2 6s

Kitchen (Program)

in the kitchen (can only be used once) runs code to manage inputs, boxes, and the dish to generate outputs. prepare order takes the first available item from the inputs, and overwrites the value of the dish. To output the dish, you either serve it to the customers (it's ready!) for numbers and strings, or directly output it (lunch break!) as a number.

in the kitchen
 prepare order
 it's ready!
 prepare order
 lunch break!

To reset the value of the dish, use throw away the dish. This can be useful if you want to clear it before using it any other command (such as adding numbers and or managing stacks).

in the kitchen
 prepare order
 throw away the dish

Fridge Management

take A from the fridge overwrites the dish's value with box A (box located at index A), and store the dish in the fridge at A overwrites box A's value with the dish's value.

fridge of 3 [#1 is A, #2 is B, #3 is temp]
 there's a -2
 there's a 4

in the kitchen
 take 1 from the fridge
 store the dish in the fridge at 3
 take 2 from the fridge
 store the dish in the fridge at 1
 take 3 from the fridge
 store the dish in the fridge at 2

stack the dish onto A stack the items of the dish on box A, and take from A, and stack onto the dish takes the last item of box A and stack it on the dish. Both commands updates both the box's value and the dish's value. For example, if you take from a stack of [1, 2, 3] and stack on top of [0], both values will be [1, 2] and [0, 3] afterwards.

fridge of 2 [#1 is the stack, #2 is the item]
 there's a bag
  there's a 4
  there's a 7
  there's a 3
  there's a 9

in the kitchen
 take from 1 and stack onto the dish
 store the dish to 2

Math Operators

To add the top of the dish with box A, use add A from the fridge with the dish. For example, you add [1, 3] (dish) with [0, 2] (box), the dish's value is [0, 5] afterwards. To subtract instead, use with A from the fridge, rip into the dish. For another example, you subtract [6, 7] (dish) with [3, 5] (box), the dish's value is [3, 2] afterwards.

orders for 1 to 1
 should i get a -20 or a 20?
 should i get a -20 or a 20?

fridge of 1

in the kitchen
 prepare order
 store the dish in the fridge at 1
 prepare order
 add 1 from the fridge with the dish
 lunch break!

To increment or decrement the top of the dish by one, use add some pepper on the dish or add some salt on the dish respectively. These commands updates the value of the dish afterwards.

in the kitchen
 prepare order
 add some pepper on the dish
 lunch break!

To increment or decrement the top of box A instead by one, use add some pepper to A from the fridge or add some salt to A from the fridge respectively. These commands updates the value of said box, and for convenience, updates the top of the dish with the same value too.

fridge of 1
 there's a 4

in the kitchen
 add some pepper to 1 from the fridge
 lunch break!
 add some pepper to 1 from the fridge
 lunch break!

Fridge Referencing

There are 8 commands that behaves similarly to other commands, but with one key difference: instead of directly using box A, it reads the top of it for an index of another box. For example, if you are reference box 1, which top is 4, it indirectly uses box 4 instead.

Normal Variation Referencing Variation
take A from the fridge looking at the top of A, take from the fridge
store the dish in the fridge at A looking at the top of A, store it in the fridge
add A from the fridge with the dish looking at the top of A, add with the dish
with A from the fridge, rip into the dish looking at the top of A, rip into the dish
add some pepper to A from the fridge looking at the top of A, add some pepper
add some salt to A from the fridge looking at the top of A, add some salt
stack the dish onto A looking at the top of A, stack onto the dish
take from A, and stack onto the dish looking at the top of A, take and stack onto the dish

Conditional Statements

Conditional statements checks the value of the dish, and runs selections of code if its condition is met. There are 7 statements to work with.

Condition Met if:
always
  • Always met, useful for general code blocks and forever loops.
is the dish missing?
  • The dish is empty, or has no value.
is there a dish?
  • The dish has a value.
is the dish cooked just right?
  • The dish's top is zero.
does the dish need more work?
  • The dish's top is not zero.
is the dish overcooked?
  • The dish's top is a positive number.
  • The dish's top is not zero.
is the dish undercooked?
  • The dish's top is a negative number.
  • The dish's top is not zero.
in the kitchen
 prepare order
 is the dish cooked just right?
  lunch break!
Else / Otherwise

not the case? is an additional part of a conditional statement. If the condition was not met, it runs a different selection of code.

in the kitchen
 prepare order
 is the dish cooked just right?
  [do this if input is zero]
 not the case?
  [do this if input is not zero]
Looping

To loop selections of code, you add check again to the conditional statement. If the condition was met, then after the statement's code has been run, it repeats to check again, hence the name. In other words, the statement repeats its code while its condition is being met.

in the kitchen
 prepare order
 store the dish in the fridge at 1
 does the dish need more work?
  lunch break!
  add some salt to 1 from the fridge
 check again
 lunch break!

If there's an else statement (not the case?) in a looping conditional statement, and if the condition was not met, then it would run the else's code and continues on the program.

Breaks and Continues

To break out of one or multiple statements, you use step back A times to stop and break out of statements by A times, then continues on afterwards. It's important to note that it refuses to loop, regardless if the now current statement loops or not. If you need to loop, use step back A times, check again instead.

orders for 6 to 8
 should i get a -4 or a 4?

fridge of 1
 there's a 0

in the kitchen
 always
  prepare order
  is there a dish?
   add 1 from the fridge with the dish
   store the dish in the fridge at 1
  not the case?
   step back 2 times
 check again
 take 1 from the fridge
 lunch break!

Dining Room (Output)

The Dining Room uses the generated customers to display served outputs to the console. The code block command associated with the dining room is in the dining room, and it can only be used once. a customer gets A and drinks first outputs output A it normally, while a customer gets A and eats it outputs output A as a string where each number is converted into a character based on its ASCII value, and it's recursive with stacks.

in the dining room
 a customer gets 1 and drinks first

To output the last item in the output stack, A should be his, hers, or theirs. after some chit chat repeats the code if there's any customers and outputs left.

Examples

A Hello, world program, which outputs Hello, world! to the console.

orders for 1 to 1
 that would be a Hello, world!?
 i'll take

in the kitchen
 prepare order
 it's ready!

in the dining room
 a customer gets his and eats it

lunchtime!

A truth-machine program. Gets user input as a number, and outputs it once if it's a zero, and forever if it's not zero (one for instance).

orders for 1 to 1
 what do you want?

fridge of 1

in the kitchen
 prepare order
 is the dish cooked just right? [0]
  lunch break!
 not the case? [1]
  store the dish in the fridge at 1
  always
   take 1 from the fridge
   lunch break!
  check again

lunchtime!

A basic multiplier program, which multiplies two numbers by user input. Does not work with negative numbers.

orders for 1 to 1
 what do you want?
 what do you want?
 i'll take

fridge of 3
 [mem #1 is B / 0, mem #2 is A, mem #3 is product]
 there's a 0

in the kitchen
 [copy #1 to #3]
 take from 1, and stack onto the dish
 store the dish in the fridge at 3
 [load inputs]
 prepare order
 store the dish in the fridge at 2
 prepare order
 store the dish in the fridge at 1
 [repeat until B is zero]
 does the dish need more work? 
  throw away the dish
  take 1 from the fridge
  add 3 from the fridge with the dish
  store the dish in the fridge at 3
  add some salt to 1 from the fridge
 check again
 [output product]
 take 3 from the fridge
 it's ready!

in the dining room
 a customer gets his and drinks first

lunchtime!

See also

GitHub Repository