PL/T Programming Language for Time

Preview:

DESCRIPTION

PL/T Programming Language for Time. Supervised by Professor Alfred V. Aho Teaching Assistant: Mr. Yan Zou Laurent Charignon (lc2817): Project Manager Sameer Choudhary (sc3363): System Integrator Imré Frotier de la Messelière (imf2108): Language Guru Tao Song (ts2695): System Architect - PowerPoint PPT Presentation

Citation preview

PL/TProgramming Language for Time

Supervised by Professor Alfred V. AhoTeaching Assistant: Mr. Yan Zou

Laurent Charignon (lc2817): Project ManagerSameer Choudhary (sc3363): System Integrator

Imré Frotier de la Messelière (imf2108): Language GuruTao Song (ts2695): System Architect

Abhijeet Tirthgirikar (apt2120): Tester and Validator

Introduction to PL/T

Example ScenarioYou want to make an alarm clock. Set it up to ring at 8:00pm today. You can input “y”to snooze it for another 10 mins. You have to terminate the program to stop the alarmotherwise it will keep on running for an hour. The alarm clock will ring for 1s and wait forinput to snooze for 1s, and it will keep doing that for 1 hour.

Introduction to PL/T (Continued…)

PL/T has following properties:-• Simple and Easy to Learn• Powerful• Robust• Portable• Intuitive• Precise

Sample Programs

void main ( ) { #|5| every 1s{ cout << "hello"; }}

Sample Programs (Continued…)

void countDown(time t) { time n = now(); time p = t;#<n, n+t> every 1s{ cout << p; p = p-1s; }cout<< "Time over!";}

Motivation

• In general purpose programing languages it is difficult to write time based programs

• Requires knowledge of threads• Idea of having time as a primitive data type• To make writing time based general purpose

operations like looping etc. easy

Project Management

What we wanted• Avoid stress by having something working

quickly• Don't have to cross our fingers the last day• Learn new practices

Project Management (Continued…)

What we have actually did• Made some compromises on the scope of the

project when it was needed• Considered the individual comfort as a top priority• Tried several paths when we are blocked• Refactored a lot• Tested the most critical features to feel confident

and avoid this

Important Language syntactic constructs

Time• time t1 = 1h2m5s1i;• time t2 = 1h1m;• t1+t2 => 2h3m5s1i• 2*t2 => 2h2m• t2/2 => 30m30s• t1 < t2 => true• t1 >t2 => false

Important Language syntactic constructs

Time

• time t = now(); cin >> t; cout << t;

• number n = 5; t = NumberToTime(n); n=TimeToNumber(t);

Important Language syntactic constructs

# Loop

• #|5|{ ... }

• #|3| every 1h{ ... }

• time t = now();

• #<t+1h,t+2h>{ ... }

• #<t,t+3h> every 2s{ ... }

Important Language syntactic constructs

# Loop

• #|5|{ ... }

• #|3| every 1h{ ... }

• time t = now();

• #<t+1h,t+2h>{ ... }

• #<t,t+3h> every 2s{ ... }

Compiler Architecture

Fig 1: Architecture Diagram in a nutshell

Compiler Architecture(Continued…)

Fig 2: Detailed Architecture Diagram

Execution (Continued)

1. input.pltvoid main(){time p = 10s;cout << p;}

2. Main.java import java.util.*;import java.lang.*;

class Main{public static void main(String argv[])double d =10000;System.out.println(BIF.intToTime((int)(p)));}

3. Comiler Output

10s

Testing

Unit Testing• JUnit Test Framework• To extensively test AST and

the code it generates• Factory methods to define

complex getCode functions

Functional Testing• Complete test suite of PLT

programs to test the compiler• Same set of PL/T programs

are used to test symbol table• Cucumber JVM - Behavior

driven development• Executes plain-text functional

descriptions as automated tests

Tools Used

• JFlex• CUP• Eclipse• Egit• Cucumber

• http://git-scm.com/• http://docs.oracle.com/javase/tutorial/• http://en.wikipedia.org/wiki/LaTeX• http://www.python.org/• http://cukes.info/images/cuke_logo.png• http://junit.sourceforge.net/ A voir sur

cette page pour reproduir ele logo en texte

• http://www.eclipse.org/• http://www.eclipse.org/egit/ a

decouper• http://www.eclipse.org/mylyn/• http://jflex.de/• http://www.cs.princeton.edu/~appel/

modern/java/CUP/

Conclusions• Communication! The minutes and the meetings matter more than

the code, be sure that everybody knows the status of the project• Have a good morale condition: no rush and focus on building a

prototype early• Keep the iteration shorts and switch roles to maintain a good morale

condition.• Welcome ideas from everyone and discuss it altogether• DVCS is a very important tool, it saves you a great amount of time• Use a set of tools you are confident with, it will matter a lot• Team building matters• Don't hesitate to change your idea• Trust your tests to refactor often and have a maintainable code

Recommended