skip to main content
10.1145/1346281.1346312acmconferencesArticle/Chapter ViewAbstractPublication PagesasplosConference Proceedingsconference-collections
research-article

Xoc, an extension-oriented compiler for systems programming

Published:01 March 2008Publication History

ABSTRACT

Today's system programmers go to great lengths to extend the languages in which they program. For instance, system-specific compilers find errors in Linux and other systems, and add support for specialized control flow to Qt and event-based programs. These compilers are difficult to build and cannot always understand each other's language changes. However, they can greatly improve code understandability and correctness, advantages that should be accessible to all programmers.

We describe an extension-oriented compiler for C called xoc. An extension-oriented compiler, unlike a conventional extensible compiler, implements new features via many small extensions that are loaded together as needed. Xoc gives extension writers full control over program syntax and semantics while hiding many compiler internals. Xoc programmers concisely define powerful compiler extensions that, by construction, can be combined; even some parts of the base compiler, such as GNU C compatibility, are structured as extensions.

Xoc is based on two key interfaces. Syntax patterns allow extension writers to manipulate language fragments using concrete syntax. Lazy computation of attributes allows extension writers to use the results of analyses by other extensions or the core without needing to worry about pass scheduling.

Extensions built using xoc include xsparse, a 345-line extension that mimics Sparse, Linux's C front end, and xlambda, a 170-line extension that adds function expressions to C. An evaluation of xoc using these and 13 other extensions shows that xoc extensions are typically more concise than equivalent extensions written for conventional extensible compilers and that it is possible to compose extensions.

Skip Supplemental Material Section

Supplemental Material

1346312.mp4

mp4

142.1 MB

References

  1. Jonathan Bachrach and Keith Playford. The Java syntactic extender (JSE). In Proceedings of the 16th annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Jason Baker and Wilson C. Hsieh. Maya: Multiple dispatch syntax extension in Java. In Proceedings of the 2002 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Tom Bergan. Typmix: a framework for implementing modular, extensible type systems. Master's thesis, University of California Los Angeles, 2007.Google ScholarGoogle Scholar
  4. Martin Bravenboer and Eelco Visser. Concrete syntax for objects: domainspecific language embedding and assimilation without restrictions. In Proceedings of the 19th annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Brian Chin, Shane Markstrum, and Todd Millstein. Semantic type qualifiers. In Proceedings of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Robert DeLine and Manuel Fahndrich. Enforcing high-level protocols in low-level software. In Proceedings of the 2001 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Bryan Ford. Parsing expression grammars: a recognition-based syntactic foundation. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides. Design Patterns. Addison-Wesley, Reading, Massachusetts, 1994.Google ScholarGoogle Scholar
  9. Paul Graham. On LISP: Advanced Techniques for Common LISP. Prentice-Hall, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Robert Grimm. Better extensibility through modular syntax. In Proceedings of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Michael Hammer. An alternative approach to macro processing. In Proceedings of the International Symposium on Extensible Languages, Grenoble, France, 1971. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Timothy P. Hart. MACRO definitions for LISP. AI Memo 57, MIT AI Project-RLE and MIT Computation Center, 1973. (reproduced in Steele and Gabriel 1993). Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Martin Hirzel and Robert Grimm. Jeannie: Granting Java native interface developers their wishes. In Proceedings of the 22nd annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Gregor Kiczales, John Lamping, Anurag Menhdhekar, Chris Maeda, Cristina Lopes, Jean-Marc Loingtier, and John Irwin. Aspect-oriented programming. In Proceedings of the European Conference on Object-Oriented Programming, 1997.Google ScholarGoogle ScholarCross RefCross Ref
  15. Charles Edwin Killian, James W. Anderson, Ryan Braud, Ranjit Jhala, and Amin M. Vahdat. Mace: language support for building distributed systems. In Proceedings of the 2007 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Donald E. Knuth. Semantics of context-free languages. Mathematical Systems Theory, 2(2):127--145, 1968.Google ScholarGoogle ScholarCross RefCross Ref
  17. Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. Hygienic macro expansion. In Proceedings of the 1986 ACM Conference on LISP and Functional Programming, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Max Krohn, Eddie Kohler, and M. Frans Kaashoek. Events can make sense. In Proceedings of the 2007 USENIX Annual Technical Conference, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Sorin Lerner, Todd Millstein, and Craig Chambers. Automatically proving the correctness of compiler optimizations. In Proceedings of the 2003 ACM SIGPLAN Conference on Programming Language Design and Implementation, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Sorin Lerner, Todd Millstein, Erika Rice, and Craig Chambers. Automated soundness proofs for dataflow analyses and transformations via local rules. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Harry R. Lewis and Christos H. Papadimitriou. Elements of the Theory of Computation. Prentice Hall PTR, Upper Saddle River, New Jersey, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. George C. Necula, Scott McPeak, S. P. Rahul, and Westley Weimer. Cil: Intermediate language and tools for analysis and transformation of C programs. In Proceedings of the 11th International Conference on Compiler Construction, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Nathanial Nystrom, Michael Clarkson, and Andrew Myers. Polyglot: an extensible compiler framework for Java. In Proceedings of the 12th International Conference on Compiler Construction, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Nathanial Nystrom, Xin Qi, and Andrew Myers. J&: nested intersection for scalable software composiiton. In Proceedings of the 21st annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Jukka Paakki. Attribute grammar paradigm: a high-level methodology in language implementation. ACM Computing Surveys, 27(2):196--255, June 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Guy L. Steele, Jr. and Richard P. Gabriel. The evolution of Lisp. In Proceedings of the 2nd ACM SIGPLAN Conference on History of Programming Languages, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. W. Teitelman. Pilot: A step towards man-computer symbiosis. Technical Report AITR-221, Massachusetts Institute of Technology, 1966. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Masaru Tomita. An efficient augmented context-free parsing algorithm. Computational Linguistics, 13(1-2):31--46, January-June 1987. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Linus Torvalds and Josh Triplett. Sparse -- a semantic parser for C. http://www.kernel.org/pub/software/devel/sparse/ (retrieved December 2007), 2007.Google ScholarGoogle Scholar
  30. Mark van den Brand, Jeroen Scheerder, Jurgen J. Vinju, and Eelco Visser. Disambiguation filters for scannerless generalized LR parsers. In Proceedings of the 11th International Conference on Compiler Construction, pages 143--158, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. E. Van Wyk, D. Bodin, L. Krishnan, and J. Gao. Silver: an extensible attribute grammar system. In Proceedings of the 7th Workshop on Language Descriptions, Tools, and Analysis, 2007a.Google ScholarGoogle Scholar
  32. Eric Van Wyk, Lijesh Krishnan, August Schwerdfeger, and Derek Bodin. Attribute grammar-based language extensions for Java. In Proceedings of the European Conference on Object-Oriented Programming, 2007b. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. Eelco Visser. Program transformation with Stratego/XT. rules, strategies, tools, and systems in Stratego/XT 0.9. Technical Report UU-CS-2004-011, Institute of Information and Computing Sciences, Utrecht University, 2004.Google ScholarGoogle Scholar
  34. Alessandro Warth, Milan Stanojević, and Todd Millstein. Statically scoped object adaptation with expanders. In Proceedings of the 21st annual ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Daniel Weise and Roger Crew. Programmable syntax macros. In Proceedings of the 1993 ACMSIGPLAN Conference on Programming Language Design and Implementation, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Phil Winterbottom. Alef reference manual. In Plan 9 Programmers Manual, Volume Two. Harcourt Brace Jovanovich, 1995.Google ScholarGoogle Scholar

Index Terms

  1. Xoc, an extension-oriented compiler for systems programming

    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
    • Published in

      cover image ACM Conferences
      ASPLOS XIII: Proceedings of the 13th international conference on Architectural support for programming languages and operating systems
      March 2008
      352 pages
      ISBN:9781595939586
      DOI:10.1145/1346281
      • cover image ACM SIGPLAN Notices
        ACM SIGPLAN Notices  Volume 43, Issue 3
        ASPLOS '08
        March 2008
        339 pages
        ISSN:0362-1340
        EISSN:1558-1160
        DOI:10.1145/1353536
        Issue’s Table of Contents
      • cover image ACM SIGARCH Computer Architecture News
        ACM SIGARCH Computer Architecture News  Volume 36, Issue 1
        ASPLOS '08
        March 2008
        339 pages
        ISSN:0163-5964
        DOI:10.1145/1353534
        Issue’s Table of Contents
      • cover image ACM SIGOPS Operating Systems Review
        ACM SIGOPS Operating Systems Review  Volume 42, Issue 2
        ASPLOS '08
        March 2008
        339 pages
        ISSN:0163-5980
        DOI:10.1145/1353535
        Issue’s Table of Contents

      Copyright © 2008 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 1 March 2008

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      ASPLOS XIII Paper Acceptance Rate31of127submissions,24%Overall Acceptance Rate535of2,713submissions,20%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader