The work presented here reformulates type qualifiers as composable language extensions that can be automatically and reliably composed by the end-user programmer. Type expressions can be annotated with type qualifiers to specify new subtyping relations that are expressive enough to detect many kinds of programming errors. Type qualifiers, as illustrated in our ABLEC extensible language framework for C, can also introduce rich forms of concrete syntax, can generate dynamic checks on data when static checks are infeasible or not appropriate, and can inject generated code that affects program behavior, for example to log or display program execution or for the run-time conversion of data. The ABLEC framework and extensions to it are implemented using context-free grammars and attribute grammars. This provides an expressive mechanism for type qualifier implementations to check for additional errors, e.g.dereferences to pointers not qualified by a “nonnull” qualifier, and generate custom and informative error messages. This approach distinguishes programmers that use language extensions from language engineers that develop extensions. The framework provides modular analyses that extension developers use to ensure that their extension will compose with other extensions that all pass these analyses. Thus, when a programmer selects a set of extensions to use they will automatically and reliably compose to form a working translator for the extended language.
Bibliographical noteFunding Information:
This material is partially based upon work supported by the National Science Foundation under Grant no. 1628929 . Any opinions, findings, and conclusions or recommendations expressed in this material are those of the author and do not necessarily reflect the views of the NSF. We thank the members of the Minnesota Extensible Language Tools (MELT) research group at the University of Minnesota for their valuable contributions to the tools and theory underlying the work presented here and for discussions that led to improvements in this paper; in particular, we thank Ted Kaminski for his development and support of ableC , and Lucas Kramer for pointing out the issues arising from the combination of type qualifiers and operator overloading that lead to a need for a concept of type classes in ableC . We thank the reviewers from the 2017 ACM SIGPLAN Conference on Generative Programming: Concepts & Experience (GPCE 2017) and from COMLAN for their comments and suggestions for improving this paper. We also thank James Noble for pointing out the connection between aspect-oriented programming and type qualifiers that inject code into the underlying program.
- Extensible languages
- Pluggable types
- Type qualifiers
- Type systems