Client/browser productivity language Ras Bodik, Thibaud Hottelier, James Ide, and Doug Kimelman(IBM)

Slides:



Advertisements
Similar presentations
CPSC 388 – Compiler Design and Construction
Advertisements

Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Other examples Interactive expanding/collapsing tree diagram Clicking nodes in the tree alters the value of a CSVG variable which in turn changes the visibility.
Semantics Static semantics Dynamic semantics attribute grammars
Introducing Formal Methods, Module 1, Version 1.1, Oct., Formal Specification and Analytical Verification L 5.
CS7100 (Prasad)L16-7AG1 Attribute Grammars Attribute Grammar is a Framework for specifying semantics and enables Modular specification.
Translator Architecture Code Generator ParserTokenizer string of characters (source code) string of tokens abstract program string of integers (object.
Garbage Collection  records not reachable  reclaim to allow reuse  performed by runtime system (support programs linked with the compiled code) (support.
CSE 425: Semantic Analysis Semantic Analysis Allows rigorous specification of a program’s meaning –Lets (parts of) programming languages be proven correct.
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
C. Varela; Adapted w/permission from S. Haridi and P. Van Roy1 Declarative Computation Model Defining practical programming languages Carlos Varela RPI.
Domain-Specific Software Engineering (DSSE). Software Engineering Concerns  There are many of them  “Classical” software architecture research has focused.
Telescoping Languages: A Compiler Strategy for Implementation of High-Level Domain-Specific Programming Systems Ken Kennedy Rice University.
1 Semantic Processing. 2 Contents Introduction Introduction A Simple Compiler A Simple Compiler Scanning – Theory and Practice Scanning – Theory and Practice.
CS 330 Programming Languages 09 / 13 / 2007 Instructor: Michael Eckmann.
November 29, 2005Christopher Tuttle1 Linear Scan Register Allocation Massimiliano Poletto (MIT) and Vivek Sarkar (IBM Watson)
Introduction to Fortran Fortran Evolution Drawbacks of FORTRAN 77 Fortran 90 New features Advantages of Additions.
Validating Streaming XML Documents Luc Segoufin & Victor Vianu Presented by Harel Paz.
Parallel Web Browser: Layout and Animation Language Ras Bodik, Thibaud Hottelier, James Ide, Doug Kimelman (IBM), Kimmo Kuusilinna (Nokia), Per Ljung (Nokia)
Chapter 3 Program translation1 Chapt. 3 Language Translation Syntax and Semantics Translation phases Formal translation models.
CSE 130 : Winter 2006 Programming Languages Ranjit Jhala UC San Diego Lecture 7: Polymorphism.
CS 330 Programming Languages 09 / 16 / 2008 Instructor: Michael Eckmann.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
BİL744 Derleyici Gerçekleştirimi (Compiler Design)1.
Chair of Software Engineering Einführung in die Programmierung Introduction to Programming Prof. Dr. Bertrand Meyer Exercise Session 10.
CS784 (Prasad)L167AG1 Attribute Grammars Attribute Grammar is a Framework for specifying semantics and enables Modular specification.
2.2 A Simple Syntax-Directed Translator Syntax-Directed Translation 2.4 Parsing 2.5 A Translator for Simple Expressions 2.6 Lexical Analysis.
Xpath Query Evaluation. Goal Evaluating an Xpath query against a given document – To find all matches We will also consider the use of types Complexity.
1 Abstract Syntax Tree--motivation The parse tree –contains too much detail e.g. unnecessary terminals such as parentheses –depends heavily on the structure.
(1.1) COEN 171 Programming Languages Winter 2000 Ron Danielson.
Chapter 1 Introduction Dr. Frank Lee. 1.1 Why Study Compiler? To write more efficient code in a high-level language To provide solid foundation in parsing.
COP 4620 / 5625 Programming Language Translation / Compiler Writing Fall 2003 Lecture 10, 10/30/2003 Prof. Roy Levow.
1 Semantic Analysis Aaron Bloomfield CS 415 Fall 2005.
COP4020 Programming Languages Semantics Prof. Xin Yuan.
Validated Model Transformation Tihamér Levendovszky Budapest University of Technology and Economics Department of Automation and Applied Informatics Applied.
Continuous Model Synthesis Paul Merrell and Dinesh Manocha In SIGGRAPH Asia 2008 발표 : 이성호.
ISBN Chapter 3 Describing Semantics -Attribute Grammars -Dynamic Semantics.
TextBook Concepts of Programming Languages, Robert W. Sebesta, (10th edition), Addison-Wesley Publishing Company CSCI18 - Concepts of Programming languages.
CS 363 Comparative Programming Languages Semantics.
Joey Paquet, 2000, Lecture 10 Introduction to Code Generation and Intermediate Representations.
Introduction to Code Generation and Intermediate Representations
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
ISBN Chapter 3 Describing Semantics.
Semantics In Text: Chapter 3.
SE424 Languages with Context A Block Structured Language.
Rich Layout from First Principles Specification, Generation, and Parallelization Adam Jiang, Leo Meyerovich with Seth Fowler, John Ng, and RasBodik Hot.
Introduction to Compiling
CSE 425: Control Abstraction I Functions vs. Procedures It is useful to differentiate functions vs. procedures –Procedures have side effects but usually.
12/9/20151 Programming Languages and Compilers (CS 421) Elsa L Gunter 2112 SC, UIUC Based in part on slides by Mattox.
Chapter 5 Introduction To Form Builder. Lesson A Objectives  Display Forms Builder forms in a Web browser  Use a data block form to view, insert, update,
Targeted Bottleneck #1: Rule Matching EECS Electrical Engineering and Computer Sciences B ERKELEY P AR L AB Parallel Cascading Style Sheets Leo Meyerovich,
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
Overview of Previous Lesson(s) Over View 3 Model of a Compiler Front End.
Chap. 7, Syntax-Directed Compilation J. H. Wang Nov. 24, 2015.
LECTURE 3 Compiler Phases. COMPILER PHASES Compilation of a program proceeds through a fixed series of phases.  Each phase uses an (intermediate) form.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
©SoftMoore ConsultingSlide 1 Structure of Compilers.
Overview of Compilation Prepared by Manuel E. Bermúdez, Ph.D. Associate Professor University of Florida Programming Language Principles Lecture 2.
CS416 Compiler Design1. 2 Course Information Instructor : Dr. Ilyas Cicekli –Office: EA504, –Phone: , – Course Web.
LECTURE 10 Semantic Analysis. REVIEW So far, we’ve covered the following: Compilation methods: compilation vs. interpretation. The overall compilation.
Chapter 3 – Describing Syntax
A Simple Syntax-Directed Translator
Overview of Compilation The Compiler BACK End
Ch. 4 – Semantic Analysis Errors can arise in syntax, static semantics, dynamic semantics Some PL features are impossible or infeasible to specify in grammar.
Compiler Lecture 1 CS510.
Overview of Compilation The Compiler BACK End
Compilers Principles, Techniques, & Tools Taught by Jing Zhang
Presented By: Darlene Banta
COP4020 Programming Languages
COP4020 Programming Languages
Presentation transcript:

Client/browser productivity language Ras Bodik, Thibaud Hottelier, James Ide, and Doug Kimelman(IBM)

Today… Slow on handheldsClumsy everywhere About 10 times slower than laptop [Meyerovich et al.]

Summary The status-quo and its flaws Bi-directional Constraints Our language Compilation using synthesis and attribute grammar.

Browser 101 DOM Tree Layout Render Scripting CSS provides primitives: – Designers compose them. – Layout solved in ~5 passes.

CSS is too restrictive Aspect ratio In general, it is not possible to use both height and width in the same constraint. Rationale: height=F(width) Example

Free The Constraints Let the designer express declaratively his intent via constraints. box.width = box.height Bi-directional constraints: Conciseness height=F(width) or width=F(height), as you want.

Bi-directional Constraints Redundancy in GUI: Multiple knobs/indicator for a single variable. Thus, many ways to update it. Scroll-Box R 1 (height, doc_height, slider_size) R 2 (doc_pos, slider_pos, height, doc_height) height doc_heightslider_sizeslider_pos doc_pos ↑ ↓ With bi-directional constraints:

Issues With Today’s Stack DOM Tree Layout Render Scripting (Some) Issues: – Limited expressiveness. → Hence, hacks, and clumsy workarounds. → Hence, not modular any more. – Not fast enough.

Related Work On Solving What would you do? Use a generic solver – Cassowary [Badros]: Analyze documents online and figures out layout. For performance, we want – Reduce runtime work by doing offline pre- computation. – Specialized solver.

Raising The Level of Abstraction A single set of primitive will not suit all uses 1.Programmers define/build primitives Scroll-box, Side-bar, Menu 2.Designers express layout using those. Side-Bar Scroll-boxImage

In a Nutshell NY Times GmailFlickr CSS

Summary & Challenges Ahead Our proposed solution is – Bi-directional constraints exposed to the designer. – Translated into directional constraints for fast solving. – Primitives are up to the user. We want all layout systems to be – Fast to solve. – Always well defined. Efficient solver for any kind of layout systems. – Compilation to attribute grammars With synthesis of local evaluation rules.

Definitions A layout system is 1.A set of primitives (modules). 2.A grammar describing valid compositions. We get extra expressiveness. We get modularity. – Primitives can be reused across layout systems.

3-Tier Architecture Safety Check:Forall Tree in G, Forall Input in Tree, Tree(input) is Satisfiable And the solution can be found with propagation only. Solver ProgrammerDesignerUser/Client G :== ScrollBox | A A :== Vbox | Hbox | A| B B :== Image | Text VBox ScrollBox Text ScrollBox VBox Text P&GTree Prtv: Instantiate P&GRender Tree Runtime inputs

Solving Generic SolverModular solver Dependencies Analysis Calculation Document: Solution P1P1 P2P2 G :== … Static reasoning Prop Fun Dependencies AG compiler Solution Tree traversals Browser:

Remember… We have two things to do: – Produce a solver – Layout always well-defined (safety check) Let me do the safety check first…

Comfusy [Kuncak et al.] Comfusy: Complete Functional Synthesis – Find all propagation functions – Generate code for them Foo-Box R(x,y,z) xyz XY Z Comfusy R(x,y,z) :== x=y+z Comfusy X(y,z)= z-y Y(z,x)=z-x Z(x,y)=x+y Summary of Foo-Box

Safety Check Reduction to reachability on hyper-graphs – Each primitive is a (non-)terminal. – Let G=(P 1, P 2, R, S) in Chomsky normal form. Build a hyper-graph representing the family of tree in G. – Primitives are summarized to hyper-graphs. – Connect them according the grammar. – Recursion translates into cycles. – Only consider propagation -> no search needed when solving Most interesting case is alternative in G. Let’s do that one.

Safety Check Again Compose the hyper graphs generated by Comfusy as follows: Let A → B, A → C, then we check reachability for: A R 1 (x,y) yx C R 3 (x,y) dc B R 2 (x,y) ba

Remember… We have two things to do: – Produce a solver – Layout always well-defined (safety check) The solver now...

Compilation to Attribute Grammar We already to reachability on hyper-graphs for the safety check. Extract tree traversals from that – Comfusy gives us code for each propagation step. – Schedule them using an AG evaluator. Our group is working on parallel AG evaluator too. [Meyerovich et al.]

Future Work Design-time parameters Reactive semantics Expressiveness/Speed Trade-off – Can the tree traversal of the solver depend on Design-time parameters Run-time inputs

That is it!

Safety Check Reduction to reachability on hyper-graphs – Each primitive is a (non-)terminal. – Let G=(P 1, P 2, R, S) in Chomsky normal form. – Proceed by induction on the grammar structure. Each variables is a node, each edges is a propagation Alternatives in G connected with B-edge – Inductive rules translate into cycles Ensures – Fast solving – Satisfiability A B C

Design Space Single Document Multi-Document Parameterized Multi- Document Grammar has single derivation Primitives with Design- time parameters More on this next slides.

Compilation to Attribute Grammar …

Bi-directional Constraints Primitives programmed with constraints. – Declarative – Bi-directional because UI have several knobs/indicators for same variable. H-Box heightwidth height1height2width1width2 +

Attribute Grammar 101 A CDE B height Given A Grammar How attributes are locally computed Returns tree traversals necessary to compute all attributes

Today… Slow on handheldsClumsy everywhere Test --> Test About 10 times slower than laptop [Meyerovich et al]