Download presentation
Presentation is loading. Please wait.
Published byKasey Choyce Modified over 10 years ago
1
The Return of Chef (TROC) A Programming Language for Cooking Recipes and Nutrition Analysis
2
TROC Project Team Jia Chen – Language Architect Jia Chen – Language Architect Jeff Hull – Tester and Validator Jeff Hull – Tester and Validator Kuang Shen – System Integrator Kuang Shen – System Integrator Yiping Xu – Tools Guru Yiping Xu – Tools Guru
3
The Purpose of TROC Healthy Diet Lifestyle 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
4
The Purpose of TROC Then comes 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; }
5
Design Principles Syntax: - Close to recipe convention 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; }
6
Design Principles Semantics:- Strongly Typed Semantics:- Strongly Typed e.g. Rule: Cook Ingredient with Cookware Cook Beef with PressureCooker Cook Beef with MixingBowl - Static Typing - Static Typing - Object inheritance - Object inheritance - Integrated Metric System - Integrated Metric System e.g. olvOil: 3 teaspoon OliveOil; equivalent to 0.5 oz OliveOil Translation done at compile time
7
Runtime Runtime Routine Calls Runtime Routine Calls - Program written in TROC is translated into java code which call functions in TROC run-time API Nutrition Facts Calculation 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
8
Execution Output Using external library to output result from Microsoft Excel Using external library to output result from Microsoft Excel
9
Input_file.troc JLex: Lexer Symbol Table CUP: Parser Semantic Analyzer Type Checking Exception Handling Troc API (written in JAVA) Intermediate Code Generator Java Compiler JVM Output
10
Runtime Environment
11
Troc Type Definition Troc Type Definition Cook Operation API Cook Operation API
12
Troc Type Hierarchy Ingredient Fruit ChickenBeef Pork CondimentSeafood VegetableMeat …… CookWare
13
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;
14
Cook Operation API Cut (IngredientType beingCutObject, ToolType toolID, int Weight,) Cut (IngredientType beingCutObject, ToolType toolID, int Weight,) Cook(IngredientType beingCookedObject, Cook(IngredientType beingCookedObject, ContainerTyper, int Weight) Other cook operations that we support: Place, Crush, Marinate, Coat,…
15
Runtime API Functionality Calculate the nutrition Calculate the nutrition Based on the formula Based on the formula Render the chart Render the chart
16
Runtime Output
17
Test Plan Smoke Test Smoke Test Begin by testing the high level features Begin by testing the high level features Unit Testing Unit Testing Create test cases for every function in API Create test cases for every function in API black-box approach black-box approach compare the actual results with expected results compare the actual results with expected results Regression Testing Regression Testing Maintained a test file, where for every new grammar construct added, we will run the test file to maintain program consistency Maintained a test file, where for every new grammar construct added, we will run the test file to maintain program consistency Tested for: Tested for: Logical errors/inconsistencies Logical errors/inconsistencies Syntax inconsistencies Syntax inconsistencies Overall success of instructions Overall success of instructions
18
Conclusions What We Learned What We Learned Aside from some healthy recipes … Aside from some healthy recipes … Gained Valuable Group work experience Gained Valuable Group work experience How to cope when a team member quits How to cope when a team member quits The ins and outs of designing a Language The ins and outs of designing a Language How to limit the scope and complexity of your project How to limit the scope and complexity of your project
19
Why Use our Language? The benefits of healthy eating are too numerous to name. Our language can help you cook and eat healthier. The benefits of healthy eating are too numerous to name. Our language can help you cook and eat healthier.
20
Questions?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.