CoZy: A very cool language for temperature control Project Manager: Hannah Keiler Language and Tools Guru: Nate Booth System Architect: Giovanni Ortuno.

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

1 Compiler Construction Intermediate Code Generation.
Annoucements  Next labs 9 and 10 are paired for everyone. So don’t miss the lab.  There is a review session for the quiz on Monday, November 4, at 8:00.
PLLab, NTHU Cs2403 Programming Languages Implementation Issues Cs2403 Programming Language Spring 2005 Kun-Yuan Hsieh.
Cpeg421-08S/final-review1 Course Review Tom St. John.
CS 240: Data Structures Tuesday, June 5 th Programming Semantics, Software Life Cycle.
28-Jun-15 Recognizers. 2 Parsers and recognizers Given a grammar (say, in BNF) and a string, A recognizer will tell whether the string belongs to the.
Applied Software Project Management Andrew Stellman & Jennifer Greene Applied Software Project Management Applied Software.
EMDL Extended Motion Description Language. EMDL vs. MDL.
1.3 Executing Programs. How is Computer Code Transformed into an Executable? Interpreters Compilers Hybrid systems.
1 Programming Languages Examples: C, Java, HTML, Haskell, Prolog, SAS Also known as formal languages Completely described and rigidly governed by formal.
Systems Software Operating Systems.
ANTLR.
ANTLR Andrew Pangborn & Zach Busser. ANTLR in a Nutshell ANother Tool for Language Recognition generates lexers generates parsers (and parse trees)‏ Java-based,
Groovy WHAT IS IT? HOW DOES IT WORK? IS IT USEFUL?
Project Manager: Kathy Sun Language Guru: Toni Ma System Architect: Mark Florian System Integrator: Kim Ly System Tester: Madhavan Somanathan COMS W4115.
Owl Andrew Olowude Ben Klingher Belai Lencho Kenneth Cheng Martin Li A language for finite automata Team 20 _________ /_ ___ \ \ \ \__/\___/ / \_\/______/
AIT 616 Fall 2002 PHP. AIT 616 Fall 2002 PHP  Special scripting language used to dynamically generate web documents  Open source – Free!!!  Performs.
Pragmatic Projects Prepared by Doug Glidden. Pragmatic Projects Pragmatic Teams Ubiquitous Automation Ruthless Testing It’s All Writing Great Expectations.
THE HOG LANGUAGE A scripting MapReduce language. Jason Halpern Testing/Validation Samuel Messing Project Manager Benjamin Rapaport System Architect Kurry.
INTERNET APPLICATION DEVELOPMENT For More visit:
EGR 2261 Unit 5 Control Structures II: Repetition  Read Malik, Chapter 5.  Homework #5 and Lab #5 due next week.  Quiz next week.
Boardr The Racing Board Game Creation Language. Project Manager: Eric Leung Language and Tools Guru: Shensi Ding System Architect: Seong Jin Park System.
1 Programming Languages Tevfik Koşar Lecture - II January 19 th, 2006.
COMPSCI 101 Principles of Programming Lecture 28 – Docstrings & Doctests.
Python Modules An Introduction. Introduction A module is a file containing Python definitions and statements. The file name is the module name with the.
Python – Part 1 Python Programming Language 1. What is Python? High-level language Interpreted – easy to test and use interactively Object-oriented Open-source.
1 COMP 3438 – Part II-Lecture 1: Overview of Compiler Design Dr. Zili Shao Department of Computing The Hong Kong Polytechnic Univ.
Chapter 6 Programming Languages (2) Introduction to CS 1 st Semester, 2015 Sanghyun Park.
Testing. 2 Overview Testing and debugging are important activities in software development. Techniques and tools are introduced. Material borrowed here.
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Interpretation Environments and Evaluation. CS 354 Spring Translation Stages Lexical analysis (scanning) Parsing –Recognizing –Building parse tree.
PL/T Programming Language for Time Supervised by Professor Alfred V. Aho Teaching Assistant: Mr. Yan Zou Laurent Charignon (lc2817): Project Manager Sameer.
Python – May 11 Briefing Course overview Introduction to the language Lab.
CS 153: Concepts of Compiler Design August 26 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
Current Assignments Homework 2 is available and is due in three days (June 19th). Project 1 due in 6 days (June 23 rd ) Write a binomial root solver using.
C463 / B551 Artificial Intelligence Dana Vrajitoru Python.
Python uses boolean variables to evaluate conditions. The boolean values True and False are returned when an expression is compared or evaluated.
Python Mini-Course University of Oklahoma Department of Psychology Day 2 – Lesson 7 Conditionals and Loops 4/18/09 Python Mini-Course: Day 2 - Lesson 7.
Graphene So what’s the most efficient way to spam all your Facebook friends? Team Adith Tekur (System Architect/Tester) Neha Rastogi (System Integrator)
PLT Final Project---COLOGO Lixing Dong, Zhou Ma, Chao Song, Siyuan Lu, Dongyang Jiang.
Chapter 1 Introduction. Chapter 1 - Introduction 2 The Goal of Chapter 1 Introduce different forms of language translators Give a high level overview.
1. 2 Preface In the time since the 1986 edition of this book, the world of compiler design has changed significantly 3.
CS 460/660 Compiler Construction. Class 01 2 Why Study Compilers? Compilers are important – –Responsible for many aspects of system performance Compilers.
Celluloid An interactive media sequencing language.
Test Specifications A Specification System for Multi-Platform Test Suite Configuration, Build, and Execution Greg Cooksey.
Unit 1 Basic Python programs, functions Special thanks to Roy McElmurry, John Kurkowski, Scott Shawcroft, Ryan Tucker, Paul Beck for their work. Except.
Decision Structures, String Comparison, Nested Structures
Python Basics Tom LeFebvre. Sept , 2002Python Basics2 Python Language Very High-Level Language Scripting Language (no compiling) Simple syntax Easy.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
What am I? while b != 0 if a > b a := a − b else b := b − a return a AST == Abstract Syntax Tree.
C H A P T E R T W O Linking Syntax And Semantics Programming Languages – Principles and Paradigms by Allen Tucker, Robert Noonan.
COMS W4115 Programming Languages and Translators Professor Alfred V. Aho GROUP 13 Project Manager - Neeraja Ramanan (nr2404) Language and Tools Guru -
What is a compiler? –A program that reads a program written in one language (source language) and translates it into an equivalent program in another language.
Dynamic Testing.
8 th Semester, Batch 2009 Department Of Computer Science SSUET.
Perfecto Mobile Automation
1 Asstt. Prof Navjot Kaur Computer Dept PRESENTED BY.
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
PROGRAMMING USING PYTHON LANGUAGE ASSIGNMENT 1. INSTALLATION OF RASPBERRY NOOB First prepare the SD card provided in the kit by loading an Operating System.
Computer Programming Week 1: The Basics of CP 1 st semester 2012 School of Information Technology Website:
CST 1101 Problem Solving Using Computers
EECS 183 Discussion #9: It’s time to “Git” Python! November 22nd, 2016
PROGRAMMING LANGUAGES
Programming Basics Web Programming.
A451 Theory – 7 Programming 7A, B - Algorithms.
Python is a general-purpose interpreted, interactive, object-oriented, and high-level programming language. It was created by Guido van Rossum during.
Learning to Program in Python
CSE401 Introduction to Compiler Construction
Java History, Editions, Version Features
Presentation transcript:

CoZy: A very cool language for temperature control Project Manager: Hannah Keiler Language and Tools Guru: Nate Booth System Architect: Giovanni Ortuno System Integrator: Daron Lin System Tester: Minghai (Ocean) Huang

CoZy schedules thermostats! “I’ll be away and want to turn my AC down” home.howstuffworks.com

But so do programmable thermostats...

Why is CoZy a better solution? - Cost: 26% of the cost of Nest - Freedom! vs

Buzzwords ●User Oriented! ●Simple ●Intuitive ●Readable ●Specific every(Sunday): SET_TEMP(27 C)

Buzzwords ●User Oriented! ●Simple ●Intuitive ●Readable ●Specific ●Statically typed ●Architecture neutral ●Portable - Compiles to Python to run on raspberry pi ●Robust every(Sunday): SET_TEMP(27 C)

Language Features

Normal features ●Functions ●Lists ●Type checking ●Lexical scoping ●Arithmetic ●Logic ●Control flow ●print ●log to file Borrrrrrrrrrrring...

Special features! ●“every” statements ●“once every” statements ●time ranges are primitive types ●temperature is primitive type ●interacts nicely with temperature sensor ●interacts nicely with “heater” Now this is cool!

every statements ●Run consistently every time their date/time condition is met ●If you want it to run at two different sets of times, separate them by semicolon ●If you want it to run when two date/time conditions are both met, separate by “during”

every statement example ●Prints “hello” from 2:45 PM to 6:50 PM and from ___ to ___ every day ●On Mondays, also prints “goodbye” from 2:00 PM to 6:52 PM

every statement example helloText = “hello” goodbyeText = “goodbye” every (2:45 PM to 6:50 PM; 6:53 PM to 11:00 PM): print(helloText) every (2:00 PM to 6:52 PM during Tuesday): print(goodbyeText)

once every statements ●Run once each time their date/time condition is met ●If you want it to run at two different sets of times, separate them by semicolon ●If you want it to run when two date/time conditions are both met, separate by “during”

once every statement example helloText = “hello” goodbyeText = “goodbye” once every (2:45 PM to 6:50 PM; 6:53 PM to 11:00 PM): print(helloText) once every (2:00 PM to 6:52 PM during Tuesday): print(goodbyeText)

How did this all come together? Lexical Analyzer, Parser, Code Generator Added features Semantic Analyzer

How did this all come together? - Communication - Meeting Minutes - Tasks - Deliverables - Version Control - Reporting Bugs

Architecture

Architecture Overview ➔ Cozy File ◆ file.cz ➔ Lexer ◆ cozyLex.py ➔ Parser ◆ cozyYacc.py ➔ Code Gen ◆ codeGenerator.py ➔ Execute Code ◆ runCozy.py Semantic Analyzer + Code Generator Lexical Analyzer Token Stream Syntax Analyzer Syntax Tree CoZy Source Code Python Code

Cozy Code to Token Stream LexToken(DEF,'def',2,1) LexToken(ID,'myFunction',2,5) LexToken(LPAREN,'(',2,15) LexToken(RPAREN,')',2,16) LexToken(COLON,':',2,17) LexToken(NEWLINE,'\n',2,18 ) INDENT LexToken(IF,'if',3,23) LexToken(LPAREN,'(',3,25) LexToken(MONDAY,'Monday',3,26) …….. def myFunction(): if(Monday): print(“It's MONDAY!!”) else: print("It's not Monday YAAY") once every(January): every(10:00 AM to 11:00 PM): myFunction() cozyLex.py

Token Stream to Abstract Syntax Tree LexToken(DEF,'def',2,1) LexToken(ID,'myFunction',2,5) LexToken(LPAREN,'(',2,15) LexToken(RPAREN,')',2,16) LexToken(COLON,':',2,17) LexToken(NEWLINE,'\n',2,18 ) INDENT LexToken(IF,'if',3,23) LexToken(LPAREN,'(',3,25) LexToken(MONDAY,'Monday',3,26) …….. program >program ->external_declaration -->function_definition: 'myFunction' --->statement_list ---->statement ----->selection_statement >or_expression >and_expression >equality_expression …….. cozyYacc.py

AST to Code program >program ->external_declaration -->function_definition: 'myFunction' --->statement_list ---->statement ----->selection_statement >or_expression >and_expression >equality_expression …….. …. if(datetime.datetime.now().weekday() == 0): print "OH NO IT"S MONDAY!!" else: print "It's not monday yaay" …. def condition1(): if ((datetime.datetime.now().weekday() == 1) and (datetime.datetime(100,1,1,10, 0))): return True …... codeGenerator.py

Dev Environment

Development Environment Unfortunately, diversity isn’t always great. + + = :(

Development Environment It was difficult, but we made it work.

Development Environment,

,

Other Tools

Version Control - Philosophy 1. Thou shalt not dirty the master branch. 2. Thou shalt pull, and pull often.

Runtime Environment CoZy srcTarget ProgramPython Raspbian OS python-rpi.gpio CoZy Compiler Python Interpreeter

Runtime Environment CoZy comes with: cozyLex.py cozyYacc.py codeGenerator.py runCozy.py Temperature.py runtimeError.py r_pi/Fake_Thermostat.py r_pi/Thermostat.py r_pi/fake_temp

Compiler Tools PLY (Python Lex-Yacc) Ultimately helped create an AST for us

Running CoZy Download CoZy.tar.gz $ tar xvzf CoZy.tar.gz $ cd CoZy $./setup $ create super awesome CoZy program $./CoZy myAwesomeCoZy.cz OR $./CoZy my AwesomeCoZy.cz -o

Testing Plan

General Testing Plan Evolution of the Testing Suite

General Testing Plan Production Branch Feature Branch... Individual-testing / Pull Request / Peer-testing

Testing Suite - Early inline testing in yacc.py and lex.py pro: fast / easy to implement con: difficult to add multiple test cases

Testing Suite: Intermediate One script to run all test cases pro: easy to add test cases con: lost track of test cases if one test case failed, others don’t execute implemented continuous loop simply append new test case to end

Testing Suite: Final Wrapped the previous python script inside a shell script - one directory, each test case in separate file - pro: easy to keep track of test cases now

DEMO

Take-Aways What we wish we did: ●Became comfortable with git/ Github early ●Developed more tests What we’re glad we did: ●Regular meetings ●Developing base and building features on top

Check us out on Github!