skip to main content
research-article
Public Access

Synthesis of layout engines from relational constraints

Published:23 October 2015Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle Scholar
  2. K. Apt. Principles of Constraint Programming. Cambridge University Press, New York, NY, USA, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. K. R. Apt and M. Wallace. Constraint Logic Programming Using Eclipse. Cambridge University Press, New York, NY, USA, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. E. Atkinson. Personal communication, 2015.Google ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. Barrett, A. Stump, and C. Tinelli. The Satisfiability Modulo Theories Library. www.smt-lib.org, 2010.Google ScholarGoogle Scholar
  8. B. Bos, T. Çelik, I. Hickson, and H. W. Lie. Css 2.1 spec. www.w3.org/TR/CSS2/, 2011.Google ScholarGoogle Scholar
  9. 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 ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. S. K. Debray and D. S. Warren. Automatic mode inference for logic programs. Journal of Logic Programming, 5(3):207–229, Sept. 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. P. Deransart and J. Maluszynski. Relating logic programs and attribute grammars. Journal of Logic Programming, 2(2): 119–155, 1985.Google ScholarGoogle ScholarCross RefCross Ref
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. IEEE Computer Society Press.Google ScholarGoogle Scholar
  18. D. E. Knuth. Semantics of context-free languages. Mathematical systems theory, 2(2):127–145, 1968.Google ScholarGoogle Scholar
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. H. Maloney. Using Constraints for User Interface Construction. PhD thesis, University of Washington, Seattle, WA, USA, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. Z. Manna and R. J. Waldinger. Toward automatic program synthesis. Communications of the ACM, 14(3):151–165, Mar. 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. S. Souders. How fast are we going now? www.stevesouders.com/blog/2013/05/09/ how-fast-are-we-going-now/, 2013.Google ScholarGoogle Scholar
  31. 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 ScholarGoogle Scholar
  32. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  33. D. M. Warme. Spanning Trees in Hypergraphs with Applications to Steiner Trees. PhD thesis, University of Virginia, Charlottesville, VA, USA, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. R. H. C. Yap. Constraint processing. Theory and Practice of Logic Programming, 4(5-6):755–757, Sept. 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library

Recommendations

Comments

Login options

Check if you have access through your login credentials or your institution to get full access on this article.

Sign in

Full Access

  • Published in

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 10
    OOPSLA '15
    October 2015
    953 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858965
    • Editor:
    • Andy Gill
    Issue’s Table of Contents
    • cover image ACM Conferences
      OOPSLA 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications
      October 2015
      953 pages
      ISBN:9781450336895
      DOI:10.1145/2814270

    Copyright © 2015 ACM

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    • Published: 23 October 2015

    Check for updates

    Qualifiers

    • research-article

PDF Format

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader
About Cookies On This Site

We use cookies to ensure that we give you the best experience on our website.

Learn more

Got it!