skip to main content
article

Type qualifiers as composable language extensions

Published:23 October 2017Publication History
Skip Abstract Section

Abstract

This paper reformulates type qualifiers as language extensions that can be automatically and reliably composed. Type qualifiers annotate type expressions to introduce new subtyping relations and are powerful enough to detect many kinds of errors. Type qualifiers, as illustrated in our ableC extensible language framework for C, can introduce rich forms of concrete syntax, can generate dynamic checks on data when static checks are infeasible or not appropriate, and inject code that affects the program's behavior, for example for conversions of data or logging.

ableC language extensions to C are implemented as attribute grammar fragments and provide an expressive mechanism for type qualifier implementations to check for additional errors, e.g. dereferences to pointers not qualified by a "nonnull" qualifier, and report custom error messages. Our approach distinguishes language extension users from developers and provides modular analyses to developers to ensure that when users select a set of extensions to use, they will automatically compose to form a working compiler.

References

  1. A.V. Aho, R. Sethi, and J.D. Ullman. 1986. Compilers – Principles, Techniques, and Tools. Addison-Wesley, Reading, MA.Google ScholarGoogle Scholar
  2. Chris Andreae, James Noble, Shane Markstrum, and Todd Millstein. 2006. A Framework for Implementing Pluggable Type Systems. In Proceedings of the ACM Conference on Object Oriented Programming, Systems, Languages, and Applications (OOPSLA ’06). ACM, 57–74. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. John Tang Boyland. 2005. Remote attribute grammars. J. ACM 52, 4 (2005), 627–687. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Martin Bravenboer and Eelco Visser. 2004. Concrete syntax for objects: domain-specific language embedding and assimilation without restrictions. In Proceedings of the ACM Conference on Object Oriented Programming, Systems, Languages, and Systems (OOPSLA ’04). ACM, 365–383. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Russel Cox, Tom Bergany, Austin Clements, Frans Kaashoek, and Eddie Kohlery. 2008. Xoc, an Extension-Oriented Compiler for Systems Programming. In Proceedings of Architectural Support for Programming Languages and Operating Systems (ASPLOS). Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Werner Dietl, Stephanie Dietzel, Michael D. Ernst, Kivanç Muşlu, and Todd W. Schiller. 2011. Building and Using Pluggable Type-checkers. In Proceedings of the 33rd International Conference on Software Engineering (ICSE ’11). ACM, New York, NY, USA, 681–690. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Torbjörn Ekman and Görel Hedin. 2007. The JastAdd extensible Java compiler. In Proceedings of the ACM Conference on Object Oriented Programming, Systems, Languages, and Systems (OOPSLA ’07). ACM, 1–18.Google ScholarGoogle Scholar
  8. Torbjörn Ekman and Görel Hedin. 2007. The JastAdd system - modular extensible compiler construction. Science of Computer Programming 69 (December 2007), 14–26. Issue 1-3.Google ScholarGoogle Scholar
  9. Sebastian Erdweg, Tillmann Rendel, Christian Kastner, and Klaus Ostermann. 2011. SugarJ: Library-based Syntactic Language Extensibility. In Proceedings of the ACM Conference on Object Oriented Programming, Systems, Languages, and Systems (OOPSLA ’11). ACM, 391–406. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. David Evans. 1996. Static Detection of Dynamic Memory Errors. In Proceedings of the ACM 1996 Conference on Programming Language Design and Implementation (PLDI ’96). ACM, 44–53. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Jeffrey Scott Foster. 2002. Type Qualifiers: Lightweight Specifications to Improve Software Quality. Ph.D. Dissertation. University of California, Berkeley.Google ScholarGoogle Scholar
  12. Jeffrey S. Foster, Manuel Fähndrich, and Alexander Aiken. 1999. A theory of type qualifiers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’99). ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Jeffrey S. Foster, Tachio Terauchi, and Alex Aiken. 2002. Flow-Sensitive Type Qualifiers. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI ’02). Berlin, Germany, 1–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Robert Grimm. 2006. Better extensibility through modular syntax. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI ’06). ACM Press, New York, NY, USA, 38–51. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. G. Hedin. 2000. Reference Attribute Grammars. Informatica 24, 3 (2000), 301–317.Google ScholarGoogle Scholar
  16. Lingxiao Jiang and Zhendong Su. 2006. Osprey: A Practical Type System for Validating Dimensional Unit Correctness of C Programs. In Proceedings of the 28th International Conference on Software Engineering (ICSE ’06). ACM, New York, NY, USA, 262–271.Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Ted Kaminski, Lucas Kramer, Travis Carlson, and Eric Van Wyk. 2017. Reliable and automatic composition of language extensions to C. Proceedings of the ACM, Programming Languages, OOPSLA 1, 98 (October 2017).Google ScholarGoogle Scholar
  18. Ted Kaminski and Eric Van Wyk. 2012. Modular well-definedness analysis for attribute grammars. In Proceedings of the International Conference on Software Language Engineering (SLE) (LNCS), Vol. 7745. Springer, 352–371.Google ScholarGoogle Scholar
  19. D. E. Knuth. 1968. Semantics of Context-free Languages. Mathematical Systems Theory 2, 2 (1968), 127–145. Corrections in 5(1971) pp. 95–96.Google ScholarGoogle ScholarCross RefCross Ref
  20. Shane Markstrum, Daniel Marino, Matthew Esquivel, Todd Millstein, Chris Andreae, and James Noble. 2010. JavaCOP: Declarative Pluggable Types for Java. ACM Transactions on Programming Languages and Systems (TOPLAS) 32, 2, Article 4 (Feb. 2010), 37 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Cyrus Omar. 2017. Reasonably Programmable Syntax. Ph.D. Dissertation. Carnegie Mellon University, Pittsburgh, USA.Google ScholarGoogle Scholar
  22. Cyrus Omar, Darya Kurilova, Ligia Nistor, Benjamin Chung, Alex Potanin, and Jonathan Aldrich. 2014. Safely Composable Type-Specific Languages. In Proceedings of the European Conference on Object Oriented Programming (ECOOP ’14), Richard Jones (Ed.). Lecture Notes in Computer Science, Vol. 8586. Springer, 105–130. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Matthew M. Papi, Mahmood Ali, Telmo Luis Correa, Jr., Jeff H. Perkins, and Michael D. Ernst. 2008. Practical Pluggable Types for Java. In Proceedings of the 2008 International Symposium on Software Testing and Analysis (ISSTA ’08). ACM, 201–212. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Tiark Rompf and Martin Odersky. 2010. Lightweight Modular Staging: A pragmatic approach to runtime code generation and compiled DSLs. In Proceedings of the ACM SIGPLAN 2010 Conference on Generative Programming and Component Engineering (GPCE ’10). ACM, New York, NY, USA, 127–136. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. August Schwerdfeger and Eric Van Wyk. 2009. Verifiable Composition of Deterministic Grammars. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI ’09). ACM, 199–210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Umesh Shankar, Kunal Talwar, Jeffrey S. Foster, and David Wagner. 2001. Detecting Format String Vulnerabilities with Type Qualifiers. In Proceedings of the 10th USENIX Security Symposium. Washington, D.C., 201–218.Google ScholarGoogle Scholar
  27. Eric Van Wyk, Derek Bodin, Jimin Gao, and Lijesh Krishnan. 2010. Silver: an Extensible Attribute Grammar System. Science of Computer Programming 75, 1–2 (January 2010), 39–54.Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. E. Van Wyk, O. de Moor, K. Backhouse, and P. Kwiatkowski. 2002. Forwarding in Attribute Grammars for Modular Language Design. In Proceedings of the 11th Conference on Compiler Construction (CC) (LNCS), Vol. 2304. Springer-Verlag, 128–142. Google ScholarGoogle ScholarCross RefCross Ref
  29. Eric Van Wyk and August Schwerdfeger. 2007. Context-Aware Scanning for Parsing Extensible Languages. In Proceedings of the International Conference on Generative Programming and Component Engineering (GPCE ’07). ACM, 63–72. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Markus Voelter, Daniel Ratiu, Bernhard Schaetz, and Bernd Kolb. 2012. Mbeddr: An Extensible C-based Programming Language and IDE for Embedded Systems. In Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity (SPLASH Wavefront ’12). ACM, New York, NY, USA, 121–140.Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. H. Vogt, S. D. Swierstra, and M. F. Kuiper. 1989. Higher-order Attribute Grammars. In Proceedings of ACM Conference on Programming Language Design and Implementation (PLDI). ACM, 131–145. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Type qualifiers as composable language extensions

        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

        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!