Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1007/978-3-662-44202-9_5guideproceedingsArticle/Chapter ViewAbstractPublication PagesConference Proceedingsacm-pubtype
Article

Safely Composable Type-Specific Languages

Published: 01 August 2014 Publication History

Abstract

Programming languages often include specialized syntax for common datatypes e.g. lists and some also build in support for specific specialized datatypes e.g. regular expressions, but user-defined types must use general-purpose syntax. Frustration with this causes developers to use strings, rather than structured data, with alarming frequency, leading to correctness, performance, security, and usability issues. Allowing library providers to modularly extend a language with new syntax could help address these issues. Unfortunately, prior mechanisms either limit expressiveness or are not safely composable: individually unambiguous extensions can still cause ambiguities when used together. We introduce type-specific languages TSLs: logic associated with a type that determines how the bodies of generic literals, able to contain arbitrary syntax, are parsed and elaborated, hygienically. The TSL for a type is invoked only when a literal appears where a term of that type is expected, guaranteeing non-interference. We give evidence supporting the applicability of this approach and formally specify it with a bidirectionally typed elaboration semantics for the Wyvern programming language.

References

[1]
Adams, M.D.: Principled parsing for indentation-sensitive languages: Revisiting Landin's offside rule. In: Principles of Programming Languages 2013
[2]
Bravenboer, M., Vermaas, R., Vinju, J.J., Visser, E.: Generalized type-based disambiguation of meta programs with concrete object syntax. In: Glück, R., Lowry, M. eds. GPCE 2005. LNCS, vol. 3676, pp. 157---172. Springer, Heidelberg 2005
[3]
Clark, T., Sammut, P., Willans, J.S.: Beyond annotations: A proposal for extensible Java XJ. In: Source Code Analysis and Manipulation 2008
[4]
de Rauglaudre, D.: Camlp4 - Reference Manual 2003, http://caml.inria.fr/pub/docs/manual-camlp4/
[5]
Diekmann, L., Tratt, L.: Parsing composed grammars with language boxes. In: Workshop on Scalable Language Specification 2013
[6]
Erdweg, S., Rendel, T., Kästner, C., Ostermann, K.: SugarJ: library-based language extensibility. In: Object-Oriented Programming Systems, Languages, and Applications 2011
[7]
Erdweg, S., Rieger, F.: A framework for extensible languages. In: Generative Programming: Concepts & Experiences 2013
[8]
Green, T., Petre, M.: Usability analysis of visual programming environments: A 'cognitive dimensions' framework. Journal of Visual Languages and Computing 72, 131---174 1996
[9]
Harper, R.: Practical Foundations for Programming Languages. Cambridge University Press 2012
[10]
Harper, R., Stone, C.: A Type-Theoretic Interpretation of Standard ML. In: Proof, Language and Interaction: Essays in Honour of Robin Milner. MIT Press 2000
[11]
Ichikawa, K., Chiba, S.: Composable user-defined operators that can express user-defined literals. In: Modularity 2014
[12]
JetBrains. JetBrains MPS --- Meta Programming System, http://www.jetbrains.com/mps/
[13]
Karakoidas, V.: On domain-specific languages usage why DSLs really matter. Crossroads 203, 16---17 2014
[14]
Kats, L.C.L., Visser, E.: The Spoofax language workbench: Rules for declarative specification of languages and IDEs. In: Object-Oriented Programming Systems, Languages, and Applications 2010
[15]
Krishnan, L., Van Wyk, E.: Termination analysis for higher-order attribute grammars. In: Czarnecki, K., Hedin, G. eds. SLE 2012. LNCS, vol. 7745, pp. 44---63. Springer, Heidelberg 2013
[16]
Lee, B., Grimm, R., Hirzel, M., McKinley, K.S.: Marco: Safe, expressive macros for any language. In: Noble, J. ed. ECOOP 2012. LNCS, vol. 7313, pp. 589---613. Springer, Heidelberg 2012
[17]
Leroy, X.: Formal verification of a realistic compiler. Communications of the ACM 2009
[18]
Loh, A., van der Storm, T., Cook, W.R.: Managed data: Modular strategies for data abstraction. In: Onward! 2012
[19]
Microsoft Corporation. Expression Trees C# and Visual Basic, http://msdn.microsoft.com/en-us/library/bb397951.aspx
[20]
Miller, H., Haller, P., Burmako, E., Odersky, M.: Instant pickles: Generating object-oriented pickler combinators for fast and extensible serialization. In: Object Oriented Programming Systems, Languages & Applications 2013
[21]
Möller, E.: SRFI-49: Indentation-sensitive syntax 2005, http://srfi.schemers.org/srfi-49/srfi-49.html
[22]
Nistor, L., Kurilova, D., Balzer, S., Chung, B., Potanin, A., Aldrich, J.: Wyvern: A simple, typed, and pure object-oriented language. In: MechAnisms for SPEcialization, Generalization and Inheritance 2013
[23]
Omar, C., Chung, B., Kurilova, D., Potanin, A., Aldrich, J.: Type-directed, whitespace-delimited parsing for embedded DSLs. In: Globalization of Domain Specific Languages 2013
[24]
Omar, C., Kurilova, D., Nistor, L., Chung, B., Potanin, A., Aldrich, J.: Safely Composable Type-Specific Languages. Technical Report CMU-ISR-14-106, Carnegie Mellon University 2014
[25]
Omar, C., Yoon, Y., LaToza, T.D., Myers, B.A.: Active code completion. In: International Conference on Software Engineering 2012
[26]
OWASP. OWASP Top 10 2013 2013, https://www.owasp.org/index.php/Top_10_2013-Top_10
[27]
Palmer, Z., Smith, S.F.: Backstage Java: Making a Difference in Metaprogramming. In: Object-Oriented Programming Systems, Languages, and Applications 2011
[28]
Pierce, B.C., Turner, D.N.: Local type inference. ACM Trans. Program. Lang. Syst. 221, 1---44 2000
[29]
Schwerdfeger, A.C., Van Wyk, E.R.: Verifiable composition of deterministic grammars. In: Programming Language Design and Implementation 2009
[30]
Sheard, T., Jones, S.: Template meta-programming for Haskell. ACM SIGPLAN Notices 3712, 60---75 2002
[31]
Stoy, J.E.: Denotational Semantics: The Scott-Strachey Approach to Programming Language Theory. MIT Press, Cambridge 1977
[32]
Tatsubori, M., Chiba, S., Killijian, M.-O., Itano, K.: OpenJava: A Class-based Macro System for Java. In: Cazzola, W., Houmb, S.H., Tisato, F. eds. Reflection and Software Engineering. LNCS, vol. 1826, pp. 117---133. Springer, Heidelberg 2000
[33]
Tempero, E., Anslow, C., Dietrich, J., Han, T., Li, J., Lumpe, M., Melton, H., Noble, J.: Qualitas corpus: A curated collection of Java code for empirical studies. In: Asia Pacific Software Engineering Conference 2010
[34]
Tratt, L.: Domain specific language implementation via compile-time meta-programming. ACM Trans. Program. Lang. Syst. 306 October 2008
[35]
van den Brand, M.G.J.: Pregmatic: A Generator for Incremental Programming Environments. PhD thesis, Katholieke Universiteit Nijmegen 1992
[36]
Van Wyk, E.R., Schwerdfeger, A.C.: Context-aware scanning for parsing extensible languages. In: Generative Programming and Component Engineering 2007

Cited By

View all
  • (2023)Rhombus: A New Spin on Macros without All the ParenthesesProceedings of the ACM on Programming Languages10.1145/36228187:OOPSLA2(574-603)Online publication date: 16-Oct-2023
  • (2020)A case study in language-based security: building an I/O library for WyvernProceedings of the 2020 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3426428.3426913(34-47)Online publication date: 18-Nov-2020
  • (2020)Syntactically Restricting Bounded Polymorphism for Decidable SubtypingProgramming Languages and Systems10.1007/978-3-030-64437-6_7(125-144)Online publication date: 30-Nov-2020
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image Guide Proceedings
Proceedings of the 28th European Conference on ECOOP 2014 --- Object-Oriented Programming - Volume 8586
August 2014
696 pages
ISBN:9783662442012
  • Editor:
  • Richard Jones

Publisher

Springer-Verlag

Berlin, Heidelberg

Publication History

Published: 01 August 2014

Author Tags

  1. bidirectional typechecking
  2. extensible languages
  3. hygiene
  4. parsing

Qualifiers

  • Article

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 06 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Rhombus: A New Spin on Macros without All the ParenthesesProceedings of the ACM on Programming Languages10.1145/36228187:OOPSLA2(574-603)Online publication date: 16-Oct-2023
  • (2020)A case study in language-based security: building an I/O library for WyvernProceedings of the 2020 ACM SIGPLAN International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software10.1145/3426428.3426913(34-47)Online publication date: 18-Nov-2020
  • (2020)Syntactically Restricting Bounded Polymorphism for Decidable SubtypingProgramming Languages and Systems10.1007/978-3-030-64437-6_7(125-144)Online publication date: 30-Nov-2020
  • (2019)Foreign language interfaces by code migrationProceedings of the 18th ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences10.1145/3357765.3359521(1-13)Online publication date: 21-Oct-2019
  • (2019)Creating Domain-Specific Languages by Composing Syntactical ConstructsPractical Aspects of Declarative Languages10.1007/978-3-030-05998-9_12(187-203)Online publication date: 14-Jan-2019
  • (2018)Inferring type rules for syntactic sugarACM SIGPLAN Notices10.1145/3296979.319239853:4(812-825)Online publication date: 11-Jun-2018
  • (2018)Reasonably programmable literal notationProceedings of the ACM on Programming Languages10.1145/32368012:ICFP(1-32)Online publication date: 30-Jul-2018
  • (2018)Inferring type rules for syntactic sugarProceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3192366.3192398(812-825)Online publication date: 11-Jun-2018
  • (2017)Type qualifiers as composable language extensionsACM SIGPLAN Notices10.1145/3170492.313605552:12(91-103)Online publication date: 23-Oct-2017
  • (2017)Reliable and automatic composition of language extensions to C: the ableC extensible language frameworkProceedings of the ACM on Programming Languages10.1145/31382241:OOPSLA(1-29)Online publication date: 12-Oct-2017
  • Show More Cited By

View Options

View options

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media