1 / 20

Wizard of House Management - Programming Language and Translators Project

Wizard of House Management - Programming Language and Translators Project. Rui Kuang Arvid Bessen Andrey Butov Svetlana Starshinina. WHOM. A programming language for creation and management of a household Language of the future: expanding the use of computers in our everyday lives

Download Presentation

Wizard of House Management - Programming Language and Translators Project

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Wizard of House Management-Programming Language and Translators Project Rui Kuang Arvid Bessen Andrey Butov Svetlana Starshinina

  2. WHOM • A programming language for creation and management of a household • Language of the future: expanding the use of computers in our everyday lives • Allows automation of tedious tasks

  3. Goals • Simple • Powerful • Event-driven • Object-oriented • Extendible

  4. What Can WHOM Do? • Specify how objects respond to changing conditions (environmental object states) • Example: if it rains, close all windows & turn off the sprinklers • Another example: if a window is broken, set off the alarm, call the police

  5. Why WHOM? • Provides easy-to-use event handling, which is important in house manipulation • Easy to use even for non-programmers

  6. Syntax and Semantics • Java-like syntax • Basic Types: • number and string • realtime and normal • Library support with “import” • Object-oriented (“class”, “extends”) • Static semantics analysis done in both AST walker and backend • Error handling class catches all the errors from Lexer, Parser, AST walker and backend to log window for displaying

  7. Recipe • Import library • Class definition • Attributes (class objects, number or string variables) • Methods • Inclass events (trigged by hardware) • Variable declaration • Event implementation • In-class event • Logic condition

  8. Example // foo.wl string msg; class foo{ number foo_num; void who_am_i(void){ msg = "I am the father"; } } class cfoo extends foo{ void who_am_i(void){ msg = "I am the child"; } } //example.whom Import “whom.wl”,“foo.wl”; foo a; cfoo b; once (SECOND == 30){ a.who_am_i(); } once (SECOND == 0){ b.who_am_i(); }

  9. Example import whom.wl; //class specification class AdjustableLamp extends Light{ number brightness = 0; void selfAdjust(){ brightness = (LIGHTNESS/10.0)*3.0; } EVENT_BUBBLE_DAD; } AdjustableLamp lamp; number oldLightness = 0; once (oldLightness–LIGHTNESS>4){ lamp.selfAdjust(); oldLightness = LIGHTNESS; } once lamp.EVENT_BUBBLE_BAD{ lamp.brightness=0; }

  10. The Backend – Main Challenges • Event-driven • Support for complex scoping rules (nested) • static / global • dynamic / stack • classes, subclasses • Class hierarchy • Object-oriented for object-oriented language: Classes corresponding to aspects of the language

  11. Overview – Main Classes • ObservableObject and Event • Events subscribe to ObservableObjects • Subscribers notified if ObservableObject changes • Expression and Statement • Scopes: ParsingScope and InstantiatedScope • Classes

  12. Walking the Tree • Get variables / objects for name (existence check) • Get methods (dynamic) • Construct expressions out of them (type checking) • Construct statement out of expressions • Statements + scope: block • Associate block with surrounding block, method, event, ...

  13. Execution • Variable changes: all events listening to it reevaluate their conditions • Condition holds: execute associated block by executing statements, by executing expressions. • Nifty features: • Recursion • Subclassing / polymorphism

  14. WHOM Testing • Intended Execution environment: • An embedded system. • Viable solution: • Software Emulator • Testing solution: • WEM & Organized test programs.

  15. WEM – [W]HOM [EM]ulator • Emulation Features • Full display of current state of household. • Dynamic update of external variables such as time. • Ability to affect the behavior of the system by modifying environment variables.

  16. WEM – Debugging Tools

  17. WEM – Organized Test Programs • Tier 1 – Source parsing & WHOM syntax. • whitespace parsing, comment parsing… • Tier 2 – Backend logic • declaration of classes • global variables • real-time variables • conditional statements • loops

  18. WEM – Organized Test Programs • Tier 3 – Event logic • event logic • events triggered by real-time / environment variables • Tier 4 – Advanced concepts • recursion • dynamically updated real-time variables

  19. WEM – Organized Test Programs • Toy Box Tier – ‘Hack’ programs • Temporary programs. If proven useful, will be moved to one of the primary tiers as part of the standard round of testing. • Experimental Tier – What If…? • Code which is ‘theoretically’ possible, but useful for no more than personal curiosity.

  20. Lessons Learned • Everything is more complicated than it appears… • But without complexity there is no fun! • We had a lot of fun working on WHOM…… • (We don’t want to live in an automated house…)

More Related