Title: The Return of Chef TROC A Programming Language for Cooking Recipes and Nutrition Analysis
1The Return of Chef (TROC) A Programming Language
for Cooking Recipes and Nutrition Analysis
2TROC Project Team
- Jia Chen Language Architect
- Jeff Hull Tester and Validator
- Kuang Shen System Integrator
- Yiping Xu Tools Guru
3 The Purpose of TROC
- Healthy Diet ? Lifestyle
- various diet services found on/offline
- which theory do I follow??
- how to know the healthiness of my own diet
- hard for amateur to calculate the nutrition
facts
4The Purpose of TROC
- Then comes TROC!
-
- 1 create your own recipes for daily diet
- 2 have nutrition facts auto-calculated
- 3 adjust recipe to healthize diet
- 4 recalculate, if still unsatisfied GOTO line
3 - 5 cook
- 6 inject food
-
5Design Principles
- Syntax - Close to recipe convention
- - Less ambiguous
- - Smooth learning curve
20-Minute Beef Stew 3 pounds boneless beef, cut
into cubes 1/3 cup flour 1 ½ cups wine 3
tablespoons oliveoil 1 onion, chopped 2 carrots,
cut into pieces 1 pound potatoes, cut into
pieces Salt and ground pepper Coat beef with
flour, salt and pepper Warm oliveoil with
pressure cooker for 3 minutes Add
wine,beef,onion,potato and carrot into the
cooker Cook on high for 20 minutes Serve.
Dish 20_Minute_BeefStew beefToBeStewed 3 lb
BonelessBeef flour 1/3 cup Flour salt 2 g
Salt pepper 1 g GroundPepper oliveOil 3
teaspoon OliveOil wine 1.5 cup RedWine onion 1
unit Onion carrot 2 unit Carrot potato 0.5 lb
Potato cut beefToBeStewed into cubes chop
onion cut carrot,potato into pieces coat
beefToBeStewed with salt, pepper, flour cook
oliveOil with PressureCooker for 3 minute cook
beefToBeStewed, onionToBeChopped, garlic,
carrot, potato, wine, oliveOil with
PressureCooker mode HIGH for 20 minute
6Design Principles
- Semantics- Strongly Typed
- e.g. Rule Cook Ingredient with Cookware
- Cook Beef with PressureCooker
- Cook Beef with MixingBowl
- - Static Typing
- - Object inheritance
- - Integrated Metric System
- e.g. olvOil 3 teaspoon OliveOil
- equivalent to 0.5 oz OliveOil
- Translation done at compile time
-
-
-
-
7Runtime
- Runtime Routine Calls
- - Program written in TROC is translated into
java code which call functions in TROC
run-time API - Nutrition Facts Calculation
- - Embedded in the TROC API functions, based on
the ingredients, tools and operations
involved - - Formula based on the online authentic
nutrient database created and maintained
by Nutrition.gov
8Execution Output
- Using external library to output result from
Microsoft Excel
9JLex Lexer
Input_file.troc
CUP
Parser
Type Checking
Symbol Table
Troc API (written in JAVA)
Exception Handling
Semantic Analyzer
Intermediate Code Generator
Java Compiler
JVM
Output
10Runtime Environment
11Runtime Environment
- Troc Type Definition
- Cook Operation API
12Troc Type Hierarchy
Ingredient
CookWare
13Inheritance
- If there is something that is not one of the food
type we already have,
Inheritance!
Grammar Mushroom is a kind of Vegetable with
white color, 10 Juiciness... M1 20 g
Mushroom
14Cook Operation API
- Cut (IngredientType beingCutObject, ToolType
toolID, int Weight,) - Cook(IngredientType beingCookedObject,
- ContainerTyper , int Weight)
- Other cook operations that we support
- Place, Crush, Marinate, Coat,
15Runtime API Functionality
- Calculate the nutrition
- Based on the formula
- Render the chart
16Runtime Output
17Test Plan
- Smoke Test
- Begin by testing the high level features
- Unit Testing
- Create test cases for every function in API
- black-box approach
- compare the actual results with expected results
- Regression Testing
- Maintained a test file, where for every new
grammar construct added, we will run the test
file to maintain program consistency - Tested for
- Logical errors/inconsistencies
- Syntax inconsistencies
- Overall success of instructions
18Conclusions
- What We Learned
- Aside from some healthy recipes
- Gained Valuable Group work experience
- How to cope when a team member quits
- The ins and outs of designing a Language
- How to limit the scope and complexity of your
project
19Why Use our Language?
- The benefits of healthy eating are too numerous
to name. Our language can help you cook and eat
healthier.
20Questions?