Abstract
We present an algorithm for synthesizing efficient document layout engines from compact relational specifications. These specifications are compact in that a single specification can produce multiple engines, each for a distinct layout situation, i.e., a different combination of known vs. unknown attributes. Technically, our specifications are relational attribute grammars, while our engines are functional attribute grammars. By synthesizing functions from relational constraints, we obviate the need for constraint solving at runtime, because functional attribute grammars can be easily evaluated according to a fixed schedule, sidestepping the backtracking search performed by constraint solvers. Our experiments show that we can generate layout engines for non-trivial data visualizations, and that our synthesized engines are between 39- and 200-times faster than general-purpose constraint solvers. Relational specifications of layout give rise to synthesis problems that have previously proved intractable. Our algorithm exploits the hierarchical, grammar-based structure of the specification, decomposing the specification into smaller subproblems, which can be tackled with off-the-shelf synthesis procedures. The new synthesis problem then becomes the composition of the functions thus generated into a correct attribute grammar, which might be recursive. We show how to solve this problem by efficient reduction to an SMT problem.
- R. Alur, R. Bodik, G. Juniwal, M. M. K. Martin, M. Raghothaman, S. A. Seshia, R. Singh, A. Solar-Lezama, E. Torlak, and A. Udupa. Syntax-guided synthesis. In FMCAD, pages 1–17. IEEE, 2013.Google Scholar
- K. Apt. Principles of Constraint Programming. Cambridge University Press, New York, NY, USA, 2003. Google Scholar
Digital Library
- K. R. Apt and M. Wallace. Constraint Logic Programming Using Eclipse. Cambridge University Press, New York, NY, USA, 2007. Google Scholar
Digital Library
- E. Atkinson. Personal communication, 2015.Google Scholar
- G. Ausiello. Directed hypergraphs: Data structures and applications. In M. Dauchet and M. Nivat, editors, CAAP ’88, volume 299 of Lecture Notes in Computer Science, pages 295–303. Springer Berlin Heidelberg, 1988. Google Scholar
Digital Library
- J. Bachrach, H. Vo, B. Richards, Y. Lee, A. Waterman, R. Avižienis, J. Wawrzynek, and K. Asanovi´c. Chisel: Constructing hardware in a scala embedded language. In Proceedings of the 49th Annual Design Automation Conference, DAC ’12, pages 1216–1225, New York, NY, USA, 2012. ACM. Google Scholar
Digital Library
- C. Barrett, A. Stump, and C. Tinelli. The Satisfiability Modulo Theories Library. www.smt-lib.org, 2010.Google Scholar
- B. Bos, T. Çelik, I. Hickson, and H. W. Lie. Css 2.1 spec. www.w3.org/TR/CSS2/, 2011.Google Scholar
- H. Comon, M. Dauchet, R. Gilleron, C. Löding, F. Jacquemard, D. Lugiez, S. Tison, and M. Tommasi. Tree automata techniques and applications. Available on: www.grappa. univ-lille3.fr/tata, 2007.Google Scholar
- L. De Moura and N. Bjørner. Z3: An efficient smt solver. In Proceedings of the Theory and Practice of Software, 14th International Conference on Tools and Algorithms for the Construction and Analysis of Systems, TACAS’08/ETAPS’08, pages 337–340, Berlin, Heidelberg, 2008. Springer-Verlag. Google Scholar
Digital Library
- S. K. Debray and D. S. Warren. Automatic mode inference for logic programs. Journal of Logic Programming, 5(3):207–229, Sept. 1988. Google Scholar
Digital Library
- P. Deransart and J. Maluszynski. Relating logic programs and attribute grammars. Journal of Logic Programming, 2(2): 119–155, 1985.Google Scholar
Cross Ref
- S. K. Feiner. A grid-based approach to automating display layout. In Proceedings on Graphics Interface ’88, pages 192– 197, Toronto, Canada, 1988. Canadian Information Processing Society. Google Scholar
Digital Library
- T. Hottelier, R. Bodik, and K. Ryokai. Programming by manipulation for layout. In Proceedings of the 27th Annual ACM Symposium on User Interface Software and Technology, UIST’ 14, pages 231–241, New York, NY, USA, 2014. ACM. Google Scholar
Digital Library
- N. Hurst, W. Li, and K. Marriott. Review of automatic document formatting. In Proceedings of the 9th ACM Symposium on Document Engineering, DocEng ’09, pages 99–108, New York, NY, USA, 2009. ACM. Google Scholar
Digital Library
- B. Johnson and B. Shneiderman. Tree-maps: A space-filling approach to the visualization of hierarchical information structures. In Proceedings of the 2Nd Conference on Visualization ’91, VIS ’91, pages 284–291, Los Alamitos, CA, USA, 1991. Google Scholar
Digital Library
- IEEE Computer Society Press.Google Scholar
- D. E. Knuth. Semantics of context-free languages. Mathematical systems theory, 2(2):127–145, 1968.Google Scholar
- V. Kuncak, M. Mayer, R. Piskac, and P. Suter. Complete functional synthesis. In Proceedings of the 2010 ACM SIGPLAN Conference on Programming Language Design and Implementation, PLDI ’10, pages 316–329, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- J. H. Maloney. Using Constraints for User Interface Construction. PhD thesis, University of Washington, Seattle, WA, USA, 1992. Google Scholar
Digital Library
- Z. Manna and R. Waldinger. A deductive approach to program synthesis. ACM Transactions on Programming Languages and Systems (TOPLAS), 2(1):90–121, Jan. 1980. Google Scholar
Digital Library
- Z. Manna and R. J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151–165, Mar. 1971. Google Scholar
Digital Library
- L. A. Meyerovich and R. Bodik. Fast and parallel webpage layout. In Proceedings of the 19th International Conference on World Wide Web, WWW ’10, pages 711–720, New York, NY, USA, 2010. ACM. Google Scholar
Digital Library
- L. A. Meyerovich, M. E. Torok, E. Atkinson, and R. Bodik. Parallel schedule synthesis for attribute grammars. In Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP ’13, pages 187–196, New York, NY, USA, 2013. ACM. Google Scholar
Digital Library
- A. Pnueli and R. Rosner. On the synthesis of a reactive module. In Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL ’89, pages 179–190, New York, NY, USA, 1989. ACM. Google Scholar
Digital Library
- M. Sannella. Skyblue: A multi-way local propagation constraint solver for user interface construction. In Proceedings of the 7th Annual ACM Symposium on User Interface Software and Technology, UIST ’94, pages 137–146, New York, NY, USA, 1994. ACM. Google Scholar
Digital Library
- R. Singh, R. Singh, Z. Xu, R. Krosnick, and A. Solar-Lezama. Modular synthesis of sketches using models. In Verification, Model Checking, and Abstract Interpretation, volume 8318 of Lecture Notes in Computer Science, pages 395–414. Springer Berlin Heidelberg, 2014.Google Scholar
- N. Sinha and R. Karim. Compiling mockups to flexible uis. In Proceedings of the 2013 9th Joint Meeting on Foundations of Software Engineering, ESEC/FSE 2013, pages 312–322, New York, NY, USA, 2013. ACM. Google Scholar
Digital Library
- A. Solar-Lezama, L. Tancau, R. Bodik, S. Seshia, and V. Saraswat. Combinatorial sketching for finite programs. In Proceedings of the 12th International Conference on Architectural Support for Programming Languages and Operating Systems, ASPLOS XII, pages 404–415, New York, NY, USA, 2006. ACM. Google Scholar
Digital Library
- S. Souders. How fast are we going now? www.stevesouders.com/blog/2013/05/09/ how-fast-are-we-going-now/, 2013.Google Scholar
- S. D. Swierstra, P. R. Azero Alcocer, and J. Saraiva. Designing and implementing combinator languages. In Advanced Functional Programming, volume 1608 of Lecture Notes in Computer Science, pages 150–206. Springer Berlin Heidelberg, 1999.Google Scholar
- B. Vander Zanden. An incremental algorithm for satisfying hierarchies of multiway dataflow constraints. ACM Transactions on Programming Languages and Systems (TOPLAS), 18 (1):30–72, Jan. 1996. Google Scholar
Digital Library
- D. M. Warme. Spanning Trees in Hypergraphs with Applications to Steiner Trees. PhD thesis, University of Virginia, Charlottesville, VA, USA, 1998. Google Scholar
Digital Library
- R. H. C. Yap. Constraint processing. Theory and Practice of Logic Programming, 4(5-6):755–757, Sept. 2004. Google Scholar
Digital Library
Recommendations
Robust relational layout synthesis from examples for Android
We present a novel approach for synthesizing robust relational layouts from examples. Given an application design consisting of a set of views and their location on the screen, we synthesize a relational layout that when rendered, places the components ...
Synthesis of layout engines from relational constraints
OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and ApplicationsWe present an algorithm for synthesizing efficient document layout engines from compact relational specifications. These specifications are compact in that a single specification can produce multiple engines, each for a distinct layout situation, i.e., ...
Conflict-Driven Synthesis for Layout Engines
Modern web browsers rely on layout engines to convert HTML documents to layout trees that specify color, size, and position. However, existing layout engines are notoriously difficult to maintain because of the complexity of web standards. This is ...






Comments