Drive-In Window JSON

From Esolang
Jump to navigation Jump to search

Drive-In Window JSON is an esolang by User:BoundedBeans capturing the semantics of Drive-In Window but in JSON format.

Namespaced IDs

A namespaced ID follows this format:

Author.ExtensionName/IndividualID

The Author, ExtensionName, and IndividualID should not contain periods or slashes.

The standard author is Diw (for Drive-In Window), which is reserved. If you go by Diw, use %Diw, if you go by %Diw, use %%Diw, if you go by %%Diw, use %%%Diw, etc. All three names should be in PascalCaseLikeThis. The characters @#$% are also reserved for various purposes. Use `A `H `D `P to encode those, and `G to encode the backtick.

If two or more authors make something together, with no particular named grouping/company/etc., they should use Combine$(author name 1)$(author name 2)$(author name 3)$(etc.) as the author.

Schema

The code is composed as a DriveInWindow.

DriveInWindow

A DriveInWindow is a JSON object with the following keys:

  • Diw.Standard/RestaurantName: A string containing the restaurant name; required but ignored.
  • Diw.Standard/Menu: A list of MenuItems containing the main dishes. Required to exist and have at least one item.
  • Diw.Standard/Sides: A list of MenuItems containing the side dishes. Default empty.
  • Diw.Standard/Orders: A list of Orders containing the commands. Required, but can be empty for a no-op program.
  • Diw.Standard/Total: A floating point number for the dollar amount at the end; required but ignored.
  • Diw.Comment/Lines: A list of strings, completely ignored and optional. Functions as comments.

MenuItem

A MenuItem is a JSON object with the following keys:

  • Diw.Standard/DishName: A string containing the name of the menu item.
  • Diw.Standard/DishPrice: A number containing the price of the menu item in dollars.
  • Diw.Comment/Lines: A list of strings, completely ignored and optional. Functions as comments.

Order

An Order is a JSON object with the following keys:

  • Diw.Standard/Command: A Command representing the command.
  • Diw.Standard/N: An integer representing the N of Person N.
  • Diw.Standard/X: An integer representing the X of Person X.
  • Diw.Standard/Item: A string representing the dish name of a main menu item.
  • Diw.Standard/SideItem: A string representing the dish name of a side menu item.
  • Diw.Standard/AlsoNot: An AlsoNotModifier representing the modifier for adding or subtracting.
  • Diw.Standard/WithHold: A WithHoldModifier representing the modifier for adding or subtracting.
  • Diw.Standard/MoreLess: A MoreLessModifier representing the modifier for adding or subtracting.
  • Diw.Standard/LoopContents: A JSON list of Orders representing the contents of the loop.
  • Diw.Comment/Lines: A list of strings, completely ignored and optional. Functions as comments.

Command

A Command is a namespaced ID as a string. Here are the following standard keys.

ID Drive-In Window command
Diw.Standard/WouldLikeMenuItem Person N would [also|not|] like (menu item)[, with (side item)|, hold the (side item)|].
Diw.Standard/PayForOrder Person N will pay for his order!
Diw.Standard/WhatGet OK, what should Person N get?
Diw.Standard/HowHave OK, how much money should Person N have?
Diw.Standard/LetsJustDoThis

Let's just do this until Person N has no more money!

(contents)

Person N has no more money!

Diw.Standard/NeedsDollars Person N needs X dollars [more|less] for his order!
Diw.Standard/WhatPersonHas Person N would like what Person X has.
Diw.Standard/JustWait Just wait while we decide...
Diw.TC/Takeout Person N would like to get takeout. (from Drive-In Window TC)
Diw.TC/BringIn Person N would like to bring in food. (from Drive-In Window TC)
Diw.TC/Review Person N is leaving a review: . (from Drive-In Window TC)
Diw.Comment/Code Completely ignored, you can use Diw.Standard/LoopContents to comment out large blocks of code in a way that can be easily nested.

AlsoNotModifier

An AlsoNotModifier is a namespaced ID as a string.

Diw.Standard/None (no modifier)
Diw.Standard/Also also
Diw.Standard/Not not

WithHoldModifier

A WithHoldModifier is a namespaced ID as a string.

Diw.Standard/None (no modifier)
Diw.Standard/With with
Diw.Standard/Hold hold

MoreLessModifier

A MoreLessModifier is a namespaced ID as a string.

Diw.Standard/More more
Diw.Standard/Less less

Examples

Cat

{
    "Diw.Standard/RestaurantName": "The_Cats_Meow",
    "Diw.Standard/Menu": [
        {
            "Diw.Standard/DishName": "Cat Food",
            "Diw.Standard/DishPrice": 10
        }
    ],
    "Diw.Standard/Orders": [
        {
            "Diw.Standard/Command": "Diw.Standard/WouldLikeMenuItem",
            "Diw.Standard/N": 1,
            "Diw.Standard/AlsoNot": "Diw.Standard/None",
            "Diw.Standard/Item": "Cat Food"
        },
        {
            "Diw.Standard/Command": "Diw.Standard/LetsJustDoThis",
            "Diw.Standard/N": 1,
            "Diw.Standard/LoopContents" [
                {
                    "Diw.Standard/Command": "Diw.Standard/WhatGet",
                    "Diw.Standard/N": 1
                },
                {
                    "Diw.Standard/Command": "Diw.Standard/PayForOrder",
                    "Diw.Standard/N": 1
                }
            ]
        }
    ],
    "Diw.Standard/Total": 39.95
}