skip to main content
research-article
Open Access
Artifacts Available
Artifacts Evaluated & Functional

Reliable and automatic composition of language extensions to C: the ableC extensible language framework

Published:12 October 2017Publication History
Skip Abstract Section

Abstract

This paper describes an extensible language framework, ableC, that allows programmers to import new, domain-specific, independently-developed language features into their programming language, in this case C. Most importantly, this framework ensures that the language extensions will automatically compose to form a working translator that does not terminate abnormally. This is possible due to two modular analyses that extension developers can apply to their language extension to check its composability. Specifically, these ensure that the composed concrete syntax specification is non-ambiguous and the composed attribute grammar specifying the semantics is well-defined. This assurance and the expressiveness of the supported extensions is a distinguishing characteristic of the approach.

The paper describes a number of techniques for specifying a host language, in this case C at the C11 standard, to make it more amenable to language extension. These include techniques that make additional extensions pass these modular analyses, refactorings of the host language to support a wider range of extensions, and the addition of semantic extension points to support, for example, operator overloading and non-local code transformations.

Skip Supplemental Material Section

Supplemental Material

References

  1. S. R. Adams. 1993. Modular Grammars for Programming Language Prototyping. Ph.D. Dissertation. University of Southampton, Department of Elec. and Comp. Sci., UK.Google ScholarGoogle Scholar
  2. A.V. Aho, R. Sethi, and J.D. Ullman. 1986. Compilers – Principles, Techniques, and Tools. Addison-Wesley, Reading, MA.Google ScholarGoogle Scholar
  3. Emilie Balland, Paul Brauner, Radu Kopetz, Pierre-Etienne Moreau, and Antoine Reilles. 2007. Tom: Piggybacking rewriting on Java. In Proceedings of the International Conference on Rewriting Techniques and Applications (RTA ’07). Google ScholarGoogle ScholarCross RefCross Ref
  4. John Tang Boyland. 2005. Remote attribute grammars. J. ACM 52, 4 (2005), 627–687. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. 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
  6. Travis Carlson and Eric Van Wyk. 2017. Type qualifiers as composable language extensions. In Proceedings of the 2017 ACM SIGPLAN International Conference on Generative Programming: Concepts & Experience (GPCE ’17). ACM, New York, NY, USA. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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
  8. Lukas Diekmann and Laurence Tratt. 2014. Eco: A Language Composition Editor. Springer International Publishing, Cham, 82–101.Google ScholarGoogle Scholar
  9. 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
  10. Torbjörn Ekman and Görel Hedin. 2007a. 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
  11. Torbjörn Ekman and Görel Hedin. 2007b. The JastAdd system - modular extensible compiler construction. Science of Computer Programming 69 (December 2007), 14–26. Issue 1-3.Google ScholarGoogle Scholar
  12. 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
  13. Sebastian Erdweg, Tijs van der Storm, and Yi Dai. 2014. Capture-Avoiding and Hygienic Program Transformations. In Proceedings of the European Conference on Object Oriented Programming (ECOOP) (Lecture Notes in Computer Science), Vol. 8586. Springer, 489–514. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. Farrow, T. J. Marlowe, and D. M. Yellin. 1992. Composable attribute grammars. In Proceedings of the ACM Symposium on Principles of Programming Languages (POPL). 223–234. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Matthew Flatt. 2010. Reference: Racket. Technical Report PLT-TR-2010-1. PLT Inc.Google ScholarGoogle Scholar
  16. Bryan Ford. 2004. Parsing expression grammars: a recognition-based syntactic foundation. In Proceedings of the Symposium on Principles of Programming Languages (POPL). ACM, 111–122. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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
  18. 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
  19. Matteo Frigo, Charles E. Leiserson, and Keith H. Randall. 1998. The implementation of the Cilk-5 multithreaded language. In Proceedings of Programming Language Design and Implementation (PLDI ’98). ACM, 212–223. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. H. Ganzinger. 1983. Increasing Modularity and Language-Independency in Automatically Generated Compilers. Science of Computer Programing 3, 3 (1983), 223–278. Google ScholarGoogle ScholarCross RefCross Ref
  21. 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
  22. G. Hedin. 2000. Reference Attribute Grammars. Informatica 24, 3 (2000), 301–317.Google ScholarGoogle Scholar
  23. P. Hudak. 1996. Building Domain-Specific Embedded Languages. Comput. Surveys 28, 4es (1996).Google ScholarGoogle Scholar
  24. Ted Kaminski. 2017. Reliably Composable Language Extensions. Ph.D. Dissertation. University of Minnesota, Minneapolis, Minnesota, USA. Available at http://hdl.handle.net/11299/188954 .Google ScholarGoogle Scholar
  25. Ted Kaminski, Lucas Kramer, Travis Carlson, and Eric Van Wyk. 2017. Reliable and automatic composition of language extensions to C — Supplemental Material. Technical Report 17-009. University of Minnesota, Department of Computer Science and Engineering. Available at https://www.cs.umn.edu/research/technical_reports/view/17-009 .Google ScholarGoogle Scholar
  26. Ted Kaminski and Eric Van Wyk. 2011. Integrating attribute grammar and functional programming language features. In Proceedings of the 4th International Conference on Software Language Engineering (SLE ’11) (LNCS), Vol. 6940. Springer, 263–282.Google ScholarGoogle Scholar
  27. 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
  28. Ted Kaminski and Eric Van Wyk. 2017. Ensuring Non-interference of Composable Language Extensions. In Proceedings of the 2017 ACM SIGPLAN International Conference on Software Language Engineering (SLE ’17). ACM, New York, NY, USA.Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. U. Kastens and W. M. Waite. 1994. Modularity and reusability in attribute grammars. Acta Informatica 31 (1994), 601–627. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Lennart C. L. Kats and Eelco Visser. 2010. The Spoofax Language Workbench. Rules for Declarative Specification of Languages and IDEs. In Proceedings of the ACM Conference on Object Oriented Programming, Systems, Languages, and Systems (OOPSLA). ACM.Google ScholarGoogle Scholar
  31. Paul Klint, Tijs van der Storm, and Jurgen Vinju. 2009. RASCAL: a Domain Specific Language for Source Code Analysis and Manipulation. In Proceedings of Source Code Analysis and Manipulation (SCAM). Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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
  33. Eugene Kohlbecker, Daniel P. Friedman, Matthias Felleisen, and Bruce Duba. 1986. Hygienic macro expansion. In Proceedings of the 1986 ACM conference on LISP and Functional Programming. ACM Press, 151–161. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Florian Lorenzen and Sebastian Erdweg. 2016. Sound Type-dependent Syntactic Language Extension. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL 2016). ACM, New York, NY, USA, 204–216. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Yogesh Mali and Eric Van Wyk. 2011. Building Extensible Specifications and Implementations of Promela with AbleP. In Proceedings of the International SPIN Workshop on Model Checking of Software (LNCS), Vol. 6823. Springer, 108–125. Google ScholarGoogle ScholarCross RefCross Ref
  36. Pierre-Etienne Moreau, Christophe Ringeissen, and Marian Vittek. 2003. A Pattern Matching Compiler for Multiple Target Languages. In Proceedings of the 12th International Conference on Compiler Construction (LNCS), Vol. 2622. Springer, 61–76.Google ScholarGoogle Scholar
  37. G. C. Necula, S. McPeak, S. P. Rahul, and W. Weimer. 2002. Cil: Intermediate Language and Tools for Analysis and Transformation of C Programs. In Proceedings of the 11th International Conference on Compiler Construction (Lecture Notes in Computer Science), Vol. 2304. Springer-Verlag, 213–228.Google ScholarGoogle Scholar
  38. Nathaniel Nystrom, Michael R. Clarkson, and Andrew C. Myer. 2003. Polyglot: An extensible compiler framework for Java. In Proceedings of the 12th International Conference on Compiler Construction (LNCS), Vol. 2622. Springer, 138–152. Google ScholarGoogle ScholarCross RefCross Ref
  39. Cyrus Omar. 2017. Reasonably Programmable Syntax. Ph.D. Dissertation. Carnegie Mellon University, Pittsburgh, USA.Google ScholarGoogle Scholar
  40. Cyrus Omar, Benjamin Chung, Darya Kurilova, Alex Potanin, and Jonathan Aldrich. 2013. Type-Directed, WhitespaceDelimited Parsing for Embedded DSLs. In Proceedings of the First Workshop on the Globalization of Domain Specific Languages (GlobalDSL ’13). ACM, New York, NY, USA, 8–11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. 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
  42. Dan Quinlan. 2000. ROSE: Compiler Support for Object-Oriented Frameworks. Parallel Processing Letters 10, 02n03 (2000), 215–226.Google ScholarGoogle ScholarCross RefCross Ref
  43. Jonathan Ragan-Kelley, Andrew Adams, Sylvain Paris, Marc Levoy, Saman Amarasinghe, and Frédo Durand. 2012. Decoupling Algorithms from Schedules for Easy Optimization of Image Processing Pipelines. ACM Transactions on Graphics 31, 4, Article 32 (July 2012), 12 pages.Google ScholarGoogle ScholarDigital LibraryDigital Library
  44. Tillmann Rendel, Jonathan Immanuel Brachthäuser, and Klaus Ostermann. 2014. From object algebras to attribute grammars. In ACM SIGPLAN Notices, Vol. 49. ACM, 377–395. Google ScholarGoogle ScholarDigital LibraryDigital Library
  45. Nico Ritschel and Sebastian Erdweg. 2015. Modular Capture Avoidance for Program Transformations. In Proceedings of the 2015 ACM SIGPLAN Conference on Software Language Engineering (SLE ’15). ACM, New York, NY, USA, 59–70.Google ScholarGoogle ScholarDigital LibraryDigital Library
  46. 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
  47. Joao Saraiva and Doaitse Swierstra. 1999. Generic Attribute Grammars. In 2nd Workshop on Attribute Grammars and their Applications. 185–204.Google ScholarGoogle Scholar
  48. August Schwerdfeger. 2010. Context-Aware Scanning and Determinism-Preserving Grammar Composition, in Theory and Practice. Ph.D. Dissertation. University of Minnesota, Department of Computer Science and Engineering, Minneapolis, Minnesota, USA. Available at http://purl.umn.edu/95605 .Google ScholarGoogle Scholar
  49. 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
  50. August Schwerdfeger and Eric Van Wyk. 2010. Verifiable Parse Table Composition for Deterministic Parsing. In Proceedings of the 2nd International Conference on Software Language Engineering (LNCS), Vol. 5969. Springer, 184–203. Google ScholarGoogle ScholarDigital LibraryDigital Library
  51. 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
  52. Charles Simonyi, Magnus Christerson, and Shane Clifford. 2006. Intentional software. SIGPLAN Notices 41, 10 (2006), 451–464. Google ScholarGoogle ScholarDigital LibraryDigital Library
  53. Anthony M. Sloane. 2011. Lightweight language processing in Kiama. In Proceedings of the 3rd summer school on Generative and Transformational Techniques in Software Engineering III (GTTSE ’09) (LNCS), Vol. 6491. Springer, 408–425. Google ScholarGoogle ScholarCross RefCross Ref
  54. 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
  55. 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
  56. Eric Van Wyk, Lijesh Krishnan, August Schwerdfeger, and Derek Bodin. 2007. Attribute Grammar-based Language Extensions for Java. In Proceedings of the European Conference on Object Oriented Programming (ECOOP) (LNCS), Vol. 4609. Springer, 575–599. Google ScholarGoogle ScholarCross RefCross Ref
  57. 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
  58. Eelco Visser. 2001. Stratego: A Language for Program Transformation based on Rewriting Strategies. System Description of Stratego 0.5. In Rewriting Techniques and Applications (RTA’01) (Lecture Notes in Computer Science), A. Middeldorp (Ed.), Vol. 2051. Springer-Verlag, 357–361. Google ScholarGoogle ScholarCross RefCross Ref
  59. Markus Voelter. 2011. Language and IDE development, modularization and composition with MPS. In Proceedings of the Generative and Transformational Techniques in Software Engineering (GTTSE ’11) (LNCS), Vol. 7680. Springer, 383–430. Google ScholarGoogle ScholarCross RefCross Ref
  60. 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
  61. 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
  62. Phil Wadler. 1998. The expression problem. (December 1998). Discussion on the Java-Genericity mailing list, available at http://homepages.inf.ed.ac.uk/wadler/papers/expression/expression.txt .Google ScholarGoogle Scholar
  63. Yanlin Wang and Bruno C. d. S. Oliveira. 2016. The Expression Problem, Trivially!. In Proceedings of the 15th International Conference on Modularity (MODULARITY ’16). ACM, New York, NY, USA, 37–41. Google ScholarGoogle ScholarDigital LibraryDigital Library
  64. D. Weise and R. Crew. 1993. Programmable Syntax Macros. ACM SIGPLAN Notices 28, 6 (1993). Google ScholarGoogle ScholarDigital LibraryDigital Library
  65. Matthias Zenger and Martin Odersky. 2005. Independently extensible solutions to the expression problem. In Proceedings of the Workshop on Foundations of Object-Oriented Languages, FOOL ’12.Google ScholarGoogle Scholar

Index Terms

  1. Reliable and automatic composition of language extensions to C: the ableC extensible language framework

      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!