200 likes | 460 Views
The Return of Chef (TROC) A Programming Language for Cooking Recipes and Nutrition Analysis. TROC Project Team. Jia Chen – Language Architect Jeff Hull – Tester and Validator Kuang Shen – System Integrator Yiping Xu – Tools Guru. The Purpose of TROC. Healthy Diet Lifestyle
E N D
The Return of Chef (TROC) A Programming Language for Cooking Recipes and Nutrition Analysis
TROC Project Team • Jia Chen – Language Architect • Jeff Hull – Tester and Validator • Kuang Shen – System Integrator • Yiping Xu – Tools Guru
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
The Purpose of TROC • Then comes TROC! { 1create 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; }
Design 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; }
Design 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
Runtime • 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
Execution Output • Using external library to output result from Microsoft Excel
JLex: 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
Runtime Environment • Troc Type Definition • Cook Operation API
Seafood Fruit Vegetable Condiment Meat Beef Chicken Pork Troc Type Hierarchy Ingredient CookWare …… ……
Inheritance 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;
Cook 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,…
Runtime API Functionality • Calculate the nutrition • Based on the formula • Render the chart
Test 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
Conclusions • 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
Why Use our Language? • The benefits of healthy eating are too numerous to name. Our language can help you cook and eat healthier.