This is a functional programming project designed to mimic a pizza ordering system
<remove_order> ::= "Remove\n" <person> <confirmation>
<new_order> ::= "New order\n" <multiple_person_orders> <confirmation>
<multiple_person_orders> ::= <person_order> | <person_order> <multiple_person_orders>
<person_order> ::= <person> <order>
<add_pizza_to_order> ::= "Add pizza\n" <person> <pizza> <confirmation>
<person> ::= ([a-z] | [A-Z])+ "\n"
<order> ::= <simple_order> | <order_bundle>
<simple_order> ::= <pizza> <order_details>
<order_bundle> ::= "Order bundle\n" (<pizza> <pizza> <pizza>) <order_details>
<pizza> ::= "Pizza:\n" <size> <crust> <toppings> <quantity>
<size> ::= ("small" | "medium" | "large") "\n"
<crust> ::= ("thin" | "thick" | "stuffed") "\n"
<toppings> ::= <topping_list>
<topping_list> ::= <topping> | <topping> <topping_list>
<topping> ::= ("pepperoni" | "mushrooms" | "onions" | "sausage" | "bacon" | "extra cheese") "\n"
<quantity> ::= <integer> "\n"
<integer> ::= [1-9]+
<order_details> ::= <order_type> <payment_method>
<order_type> ::= ("Delivery" | "Pickup") "\n"
<payment_method> ::= ("Credit Card" | "Cash" | "Mobile Payment") "\n"
<confirmation> ::= ("Confirm") "\n"
new_order
- makes an order
Example:
New order
Kajus
Pizza:
large
stuffed
pepperoni
7
Pickup
Credit Card
Jonas
Order bundle
Pizza:
large
thick
pineapple
pepperoni
11
Pizza:
large
thin
black olives
bacon
3
Pizza:
small
stuffed
extra cheese
pineapple
4
Delivery
Credit Card
Tomas
Pizza:
medium
thick
pineapple
7
Delivery
Mobile Payment
Confirm
remove_order
- removes an order
Remove
Kajus
Pizza:
large
stuffed
pepperoni
7
Pickup
Credit Card
Confirm
add_pizza_to_order
- adds pizza to order
Add pizza
Kajus
Pizza:
small thin mushrooms
2
Pickup
Credit Card
Confirm
-
save
- saves the current state. Information is saved instate.txt
.Example:
>>> save
-
load
- loads the state fromstate.txt
Example:
>>> load
-
Batch queries
With
:paste
a batch mode is enabled. User is able to write multiple queries that start withBEGIN
and end withEND
.Example:
>>> :paste | BEGIN | <...> | END
Pressing
Ctrl + D
ends this mode