skip to main content
short-paper

Generating safe boundary APIs between typed EDSLs and their environments

Published:26 October 2015Publication History
Skip Abstract Section

Abstract

Embedded domain specific languages (EDSLs) are used to represent special-purpose code in a general-purpose language and they are used for applications like vector calculations and run-time code generation. Often, code in an EDSL is compiled to a target (e.g. GPU languages, JVM bytecode, assembly, JavaScript) and needs to interface with other code that is available at that level but uses other data representations or calling conventions. We present an approach for safely making available such APIs in a typed EDSL, guaranteeing correct conversions between data representations and the respect for calling conventions. When the code being interfaced with is the result of static compilation of host language code, we propose a way to auto-generate the needed boilerplate using meta-programming. We instantiate our technique with JavaScript as the target language, JS-Scala as the EDSL, Scala.js as the static compiler and Scala macros to generate the boilerplate, but our design is more generally applicable. We provide evidence of usefulness of our approach through a prototype implementation that we have applied in a non-trivial code base.

References

  1. M. Blume. No-Longer-Foreign: Teaching an ML compiler to speak C “natively”. ENTCS, pages 36–52, 2001.Google ScholarGoogle Scholar
  2. M. M. T. Chakravarty. C → HASKELL, or Yet Another Interfacing Tool. In IFL, pages 131–148. Springer-Verlag, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. S. Doeraene. Scala.js: Type-Directed Interoperability with Dynamically Typed Languages. Technical Report EPFL-REPORT-190834, EPFL, 2013.Google ScholarGoogle Scholar
  4. Google. Google web toolkit. online, 2006. URL http://gwtproject.org/. G. Kossakowski, N. Amin, T. Rompf, and M. Odersky. JavaScript as an embedded DSL. In ECOOP, pages 409–434. Springer-Verlag, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Microsoft. Typescript. online, 2012. URL http://www.typescriptlang.org/. B. Reynders, D. Devriese, and F. Piessens. Multi-Tier Functional Reactive Programming for the Web. In Onward!, pages 55–68. ACM, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. T. Rompf and M. Odersky. Lightweight modular staging: A pragmatic approach to runtime code generation and compiled DSLs. In GPCE, pages 127–136. ACM, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Introduction Safe Boundary APIs Transformation Case Study: MT-FRP in Scala Future Work Related WorkGoogle ScholarGoogle Scholar

Index Terms

  1. Generating safe boundary APIs between typed EDSLs and their environments

    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

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 51, Issue 3
      GPCE '15
      March 2016
      184 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2936314
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        GPCE 2015: Proceedings of the 2015 ACM SIGPLAN International Conference on Generative Programming: Concepts and Experiences
        October 2015
        184 pages
        ISBN:9781450336871
        DOI:10.1145/2814204

      Copyright © 2015 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 26 October 2015

      Check for updates

      Qualifiers

      • short-paper
    • Article Metrics

      • Downloads (Last 12 months)3
      • Downloads (Last 6 weeks)1

      Other Metrics

    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!