Incremental Compilation in Compose*

Total Page:16

File Type:pdf, Size:1020Kb

Incremental Compilation in Compose* Incremental Compilation in Compose? A thesis submitted for the degree of Master of Science at the University of Twente Dennis Spenkelink Enschede, October 28, 2006 Research Group Graduation Committee Twente Research and Education prof. dr. ir. M. Aksit on Software Engineering dr. ir. L.M.J. Bergmans Faculty of Electrical Engineering, M.Sc. G. Gulesir Mathematics and Computer Science University of Twente Abstract Compose? is a project that provides aspect-oriented programming for object-oriented lan- guages by using the composition filters model. In particular, Compose?.NET is an implemen- tation of Compose? that provides aspect-oriented programming to Microsoft Visual Studio languages. The compilation process of Compose?.NET contains multiple compilation modules. Each of them has their own responsibilities and duties such as parsing, analysis tasks and weaving. However, all of them suffer from the same problem. They do not support any kind of incre- mentality. This means that they perform all of their operations in each compilation without taking advantage of the results and efforts of previous compilations. This unavoidably results in compilations containing many redundant repeats of operations, which slow down compila- tion. To minimize these redundant operations and hence, speed up the compilation, Compose? needs an incremental compilation process. Therefore, we have developed a new compilation module called INCRE. This compilation module provides incremental performance as a service to all other compilation modules of Compose?. This thesis describes in detail the design and implementation of this new compila- tion module and evaluates its performance by charts of tests. i Acknowledgements My graduation time was a long but exciting process and I would not have missed it for the world. Many people contributed to the completion of this thesis, for which I am grateful. In particular, I would like to express my appreciation to the following people. First, I would like to thank my supervisor Lodewijk Bergmans for his enthusiastic and expert guiding. In addition, I am thankful to Gurcan Gulesir and Istvan´ Nagy for their assistance in writing this thesis. Furthermore, I thank my fellow members of the Compose? project for their valuable comments and tips. I learned a lot from you guys. Finally, many thanks go to my family for encouraging me to do my best and supporting me all the way. iii Contents Abstract i Acknowledgements iii List of Figures xii List of Listings xiv Reading Guide xv 1 Introduction to AOSD 1 1.1 Introduction . 1 1.2 Traditional Approach . 2 1.3 AOP Approach . 4 1.3.1 AOP Composition . 5 1.3.2 Aspect Weaving . 5 1.3.2.1 Source Code Weaving . 5 1.3.2.2 Intermediate Language Weaving . 6 1.3.2.3 Adapting the Virtual Machine . 6 1.4 AOP Solutions . 7 1.4.1 AspectJ Approach . 7 1.4.2 Hyperspaces Approach . 9 1.4.3 Composition Filters . 10 2 Compose? 12 2.1 Evolution of Composition Filters . 12 2.2 Composition Filters in Compose? ........................... 13 2.3 Demonstrating Example . 15 2.3.1 Initial Object-Oriented Design . 15 2.3.2 Completing the Pacman Example . 17 v 2.3.2.1 Implementation of Scoring . 17 2.3.2.2 Implementation of Dynamic Strategy . 18 2.4 Compose? Architecture . 18 2.4.1 Integrated Development Environment . 18 2.4.2 Compile Time . 21 2.4.3 Adaptation . 21 2.4.4 Runtime . 21 2.5 Platforms . 21 2.6 Features Specific to Compose? ............................. 22 3 Problem Statement 25 3.1 Background . 25 3.1.1 OOP Work on Incremental Compilation . 25 3.1.1.1 Make Tool . 26 3.1.1.2 Jikes . 26 3.1.1.3 Tichy’s Smart Recompilation . 26 3.1.1.4 Eclipse Compiler . 27 3.1.1.5 IBM VisualAge C++ . 27 3.1.2 AOP Work on Incremental Compilation . 28 3.1.2.1 Whole-program and Incremental Weaving . 28 3.1.2.2 Crosscutting Complicates Incremental Weaving . 28 3.1.2.3 Incremental Weavers . 28 3.2 Non-incremental Compilation in Compose? ..................... 29 3.3 Motivation . 31 3.4 Problem Summary and Conclusion . 32 4 Solution Approaches 33 4.1 Model of a Compilation Module in Compose? .................... 33 4.2 Restoration in Seven Steps . 35 4.3 Rebuilding in Five Steps . 37 4.4 Comparison of Solution Approaches . 38 4.4.1 Comparison Criteria . 38 4.4.2 Applying the Comparison Criteria . 39 4.4.2.1 Criteria applied to Restoration and Rebuilding . 39 4.4.2.2 Conclusion . 40 5 Design Alternatives Rebuilding Approach 41 5.1 Design Decisions . 41 5.2 Storage and Retrieval . 42 5.2.1 Java Object Serialization (JOS) . 42 5.2.2 Java Database Connectivity (JDBC) . 43 5.2.3 Java Data Objects (JDO) . 44 5.2.4 Comparison Criteria . 46 5.2.5 Applying the Criteria . 47 5.2.5.1 Criteria applied to JOS . 47 5.2.5.2 Criteria applied to JDBC . 48 5.2.5.3 Criteria applied to JDO . 48 5.2.6 Choice Motivation . 49 5.2.7 Limitations of chosen alternative . 50 5.3 Data Comparison . 50 5.3.1 File Comparison . 50 5.3.1.1 Byte-by-byte comparison . 50 5.3.1.2 Timestamp comparison . 50 5.3.2 Repository Entities Comparison . 51 5.4 Acquisition of Dependent Data . 53 5.5 Conclusion . 55 6 Implementation 56 6.1 Adaptations to the Compose? architecture . 56 6.2 XML configuration file . 58 6.3 Implementation of the object comparator mechanism . 59 6.4 Reporting . 62 6.5 Control Flow . 63 6.5.1 IsProcessedBy service . 64 6.6 Conclusion . 66 7 Realization of Incremental Compose? Compilation Modules 67 7.1 Compilation Modules Enhanced . 67 7.2 Step One: Identifying Input, Output and Data Dependencies . 68 7.2.1 FILTH Analysis . 68 7.2.2 RECOMA Analysis . 69 7.3 Step Two: Serializing Repository . 70 7.4 Step Three: Implementing Copy Operation . 70 7.4.1 Copy Operation FILTH . 70 7.4.2 Copy Operation RECOMA . 71 7.5 Step Four: Configuring Data Dependencies . 71 7.5.1 Dependency Configuration FILTH . 71 7.5.2 Dependency Configuration RECOMA . 72 7.6 Step Five: Optimizing Repository Entity Comparison . 73 7.6.1 Comparison Configuration FILTH . 73 7.6.2 Comparison Configuration RECOMA . 74 7.7 Conclusion . 74 8 Evaluation 75 8.1 Test Cases and Conditions . 75 8.1.1 Cases . 75 8.1.2 Conditions . 76 8.2 Charts and Expected Results . 76 8.3 Non-incremental Compilation Time of Compilation Modules . 79 8.4 Performance Improvement by Example and Scenario . 80 8.5 Overhead by Example and Scenario . 81 8.6 Average Performance of Compilation Modules . 82 8.7 Evaluation of INCRE . 83 8.8 Evaluation of COPPER . ..
Recommended publications
  • Some Global Optimizations for a Prolog Compiler
    View metadata, citation and similar papers at core.ac.uk brought to you by CORE provided by Elsevier - Publisher Connector J. LOGIC PROGRAMMING 1985:1:43-66 43 SOME GLOBAL OPTIMIZATIONS FOR A PROLOG COMPILER C. S. MELLISH 1. INTRODUCTION This paper puts forward the suggestion that many PROLOG programs are not radically different in kind from programs written in conventional languages. For these programs, it should be possible for a PROLOG compiler to produce code of similar efficiency to that of other compilers. Moreover, there is no reason why reasonable efficiency should not be obtained without special-purpose hardware. Therefore, at the same time as pursuing the goal of special hardware for running PROLOG programs, we should be looking at how to maximize the use of conven- tional machines and to capitalize on developments in conventional hardware. It seems unlikely that conventional machines can be efficiently used by PROLOG programs without the use of sophisticated compilers. A number of possible optimiza- tions that can be made on the basis of a static, global analysis of programs are presented, together with techniques for obtaining such analyses. These have been embodied in working programs. Timing figures for experimental extensions to the POPLOG PROLOG compiler are presented to make it plausible that such optimiza- tions can indeed make a difference to program efficiency. 2. WHAT ARE REAL PROLOG PROGRAMS LIKE? It is unfortunate that very little time has been spent on studying what kinds of programs PROLOG programmers actually write. Such a study would seem to be an important prerequisite for trying to design a PROLOG optimising compiler.
    [Show full text]
  • Separate Compilation As a Separate Concern
    Separate Compilation as a Separate Concern A Framework for Language-Independent Selective Recompilation Nathan Bruning Separate Compilation as a Separate Concern THESIS submitted in partial fulfillment of the requirements for the degree of MASTER OF SCIENCE in COMPUTER SCIENCE by Nathan Bruning born in Dordrecht, the Netherlands Software Engineering Research Group Department of Software Technology Faculty EEMCS, Delft University of Technology Delft, the Netherlands www.ewi.tudelft.nl c 2013 Nathan Bruning. All rights reserved. Separate Compilation as a Separate Concern Author: Nathan Bruning Student id: 1274465 Email: [email protected] Abstract Aspect-oriented programming allows developers to modularize cross-cutting con- cerns in software source code. Concerns are implemented as aspects, which can be re-used across projects. During compilation or at run-time, the cross-cutting aspects are “woven” into the base program code. After weaving, the aspect code is scattered across and tangled with base code and code from other aspects. Many aspects may affect the code generated by a single source module. It is difficult to predict which dependencies exist between base code modules and aspect modules. This language-specific information is, however, crucial for the development of a compiler that supports selective recompilation or incremental compilation. We propose a reusable, language-independent framework that aspect-oriented lan- guage developers can use to automatically detect and track dependencies, transpar- ently enabling selective recompilation. Our implementation is based on Stratego/XT, a framework for developing transformation systems. By using simple and concise rewrite rules, it is very suitable for developing domain-specific languages. Thesis Committee: Chair: Prof.
    [Show full text]
  • Incremental Flow Analysis 1 Introduction 2 Abstract Interpretation
    Incremental Flow Analysis Andreas Krall and Thomas Berger Institut fur Computersprachen Technische Universitat Wien Argentinierstrae A Wien fanditbgmipscomplangtuwienacat Abstract Abstract interpretation is a technique for ow analysis widely used in the area of logic programming Until now it has b een used only for the global compilation of Prolog programs But the programming language Prolog enables the programmer to change the program during run time using the builtin predicates assert and retract To supp ort the generation of ecient co de for programs using these dynamic database predicates we extended abstract interpretation to b e executed incrementally The aim of incremental abstract interpretation is to gather program information with minimal reinterpretation at a program change In this pap er we describ e the implementation of incremental abstract interpretation and the integration in our VAM based Prolog P compiler Preliminary results show that incremental global compilation can achieve the same optimization quality as global compilation with little additional cost Intro duction Since several years we do research in the area of implementation of logic programming lan guages To supp ort fast interpretation and compilation of Prolog programs we develop ed the VAM Vienna Abstract Machine with two instruction p ointers Kra KN and P the VAM Vienna Abstract Machine with one instruction p ointer KB Although P the VAM manages more information ab out a program than the WAM Warren Abstract Machine War it is necessary to add ow analysis
    [Show full text]
  • Successful Lisp - Contents
    Successful Lisp - Contents Table of Contents ● About the Author ● About the Book ● Dedication ● Credits ● Copyright ● Acknowledgments ● Foreword ● Introduction 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 Appendix A ● Chapter 1 - Why Bother? Or: Objections Answered Chapter objective: Describe the most common objections to Lisp, and answer each with advice on state-of-the-art implementations and previews of what this book will explain. ❍ I looked at Lisp before, and didn't understand it. ❍ I can't see the program for the parentheses. ❍ Lisp is very slow compared to my favorite language. ❍ No one else writes programs in Lisp. ❍ Lisp doesn't let me use graphical interfaces. ❍ I can't call other people's code from Lisp. ❍ Lisp's garbage collector causes unpredictable pauses when my program runs. ❍ Lisp is a huge language. ❍ Lisp is only for artificial intelligence research. ❍ Lisp doesn't have any good programming tools. ❍ Lisp uses too much memory. ❍ Lisp uses too much disk space. ❍ I can't find a good Lisp compiler. ● Chapter 2 - Is this Book for Me? Chapter objective: Describe how this book will benefit the reader, with specific examples and references to chapter contents. ❍ The Professional Programmer http://psg.com/~dlamkins/sl/contents.html (1 of 13)11/3/2006 5:46:04 PM Successful Lisp - Contents ❍ The Student ❍ The Hobbyist ❍ The Former Lisp Acquaintance ❍ The Curious ● Chapter 3 - Essential Lisp in Twelve Lessons Chapter objective: Explain Lisp in its simplest form, without worrying about the special cases that can confuse beginners.
    [Show full text]
  • The PLT Course at Columbia
    Alfred V. Aho [email protected] The PLT Course at Columbia Guest Lecture PLT September 10, 2014 Outline • Course objectives • Language issues • Compiler issues • Team issues Course Objectives • Developing an appreciation for the critical role of software in today’s world • Discovering the principles underlying the design of modern programming languages • Mastering the fundamentals of compilers • Experiencing an in-depth capstone project combining language design and translator implementation Plus Learning Three Vital Skills for Life Project management Teamwork Communication both oral and written The Importance of Software in Today’s World How much software does the world use today? Guesstimate: around one trillion lines of source code What is the sunk cost of the legacy software base? $100 per line of finished, tested source code How many bugs are there in the legacy base? 10 to 10,000 defects per million lines of source code Alfred V. Aho Software and the Future of Programming Languages Science, v. 303, n. 5662, 27 February 2004, pp. 1331-1333 Why Take Programming Languages and Compilers? To discover the marriage of theory and practice To develop computational thinking skills To exercise creativity To reinforce robust software development practices To sharpen your project management, teamwork and communication (both oral and written) skills Why Take PLT? To discover the beautiful marriage of theory and practice in compiler design “Theory and practice are not mutually exclusive; they are intimately connected. They live together and support each other.” [D. E. Knuth, 1989] Theory in practice: regular expression pattern matching in Perl, Python, Ruby vs. AWK Running time to check whether a?nan matches an regular expression and text size n Russ Cox, Regular expression matching can be simple and fast (but is slow in Java, Perl, PHP, Python, Ruby, ...) [http://swtch.com/~rsc/regexp/regexp1.html, 2007] Computational Thinking – Jeannette Wing Computational thinking is a fundamental skill for everyone, not just for computer scientists.
    [Show full text]
  • An Extension to the Eclipse IDE for Cryptographic Software Development
    Universidade do Minho Conselho de Cursos de Engenharia Mestrado em Inform´atica Master Thesis 2007/2008 An Extension to the Eclipse IDE for Cryptographic Software Development Miguel Angelo^ Pinto Marques Supervisores: Manuel Bernardo Barbosa - Dept. de Inform´aticada Universidade do Minho Acknowledgments First of all I would like to thank my supervisor Manuel Bernardo Barbosa for all oppor- tunities, guidance and comprehension that he has provided to me. I would also like to thank my friends, Andr´e,Pedro and Ronnie for the support given to me during this difficult year. To Ana the kindest person in the world, who is always there for me. And finally, to my mother to whom I dedicate this thesis. Thank you all, Miguel \Prediction is very difficult, especially about the future." Niels Bohr ii Abstract Modern software is becoming more and more, and the need for security and trust is de- terminant issue. Despite the need for sophisticated cryptographic techniques, the current development tools do not provide support for this specific domain. The CACE project aims to develop a toolbox that will provide support on the specific domain of cryptography. Several partners will focus their expertise in specific domains of cryptography providing tools or new languages for each domain. Thus, the use of a tool integration platform has become an obvious path to follow, the Eclipse Platform is defined as such. Eclipse has proven to be successfully used as an Integrated Development Environment. The adoption of this platform is becoming widely used due to the popular IDE for Java Development (Java Development Tools).
    [Show full text]
  • Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System
    Delft University of Technology Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System Smits, J.; Konat, G.D.P.; Visser, Eelco DOI 10.22152/programming-journal.org/2020/4/16 Publication date 2020 Document Version Final published version Published in Art, Science, and Engineering of Programming Citation (APA) Smits, J., Konat, G. D. P., & Visser, E. (2020). Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System. Art, Science, and Engineering of Programming, 4(3), [16]. https://doi.org/10.22152/programming-journal.org/2020/4/16 Important note To cite this publication, please use the final published version (if applicable). Please check the document version above. Copyright Other than for strictly personal use, it is not permitted to download, forward or distribute the text or part of it, without the consent of the author(s) and/or copyright holder(s), unless the work is under an open content license such as Creative Commons. Takedown policy Please contact us and provide details if you believe this document breaches copyrights. We will remove access to the work immediately and investigate your claim. This work is downloaded from Delft University of Technology. For technical reasons the number of authors shown on this cover page is limited to a maximum of 10. Constructing Hybrid Incremental Compilers for Cross-Module Extensibility with an Internal Build System Jeff Smitsa, Gabriël Konata, and Eelco Vissera a Delft University of Technology, The Netherlands Abstract Context Compilation time is an important factor in the adaptability of a software project. Fast recompilation enables cheap experimentation with changes to a project, as those changes can be tested quickly.
    [Show full text]
  • Incremental Compilation
    VisualAge® C++ Professional for AIX® Incremental Compilation Ve r s i o n 5.0 Note! Before using this information and the product it supports, be sure to read the general information under “Notices” on page v. Edition Notice This edition applies to Version 5.0 of IBM® VisualAge C++ and to all subsequent releases and modifications until otherwise indicated in new editions. Make sure you are using the correct edition for the level of the product. © Copyright International Business Machines Corporation 1998, 2000. All rights reserved. US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. Contents Notices ...............v Build in a Team Environment ........17 Programming Interface Information ......vii Projects and Subprojects ..........17 Trademarks and Service Marks ........vii Project Files ..............19 Industry Standards ...........viii How Project Files Are Processed ......19 Example: Project File ...........20 About This Book...........ix Related Configuration Files ........20 Project File Syntax ............21 Chapter 1. Incremental Compilation Chapter 3. Using the Incremental Concepts ..............1 Compiler ..............27 Incremental C++ Builds...........1 Build ................27 Incremental Configuration Files ........2 Build from the Command Line ........28 Basic Configuration Files .........3 Build Executable Programs .........29 More Complex Configuration Files ......3 Group Source Files in a Configuration .....29 Configuration File Directives .........4 Compile and Bind Resources ........30 Configuration File Syntax ..........6 Macros in C++ Source Files .........30 Example: Configuration File .........7 Search Paths for Included Source Files (AIX) . 32 How Configuration Files are Processed .....8 Cleaning Up After Builds..........33 Sources ................9 When to Use Makefiles ..........35 Primary vs Secondary Sources .......11 Macro vs Non-macro Sources .......11 Targets ................12 Chapter 4.
    [Show full text]
  • Using an IDE
    Using an IDE Tools are a big part of being a productive developer on OpenJFX and we aim to provide excellent support for all three major IDEs: NetBeans, IntelliJ IDEA, and Eclipse. Regardless of which development environment you prefer, you should find it easy to get up and running with OpenJFX. We hope you will return the favor by submitting patches and bug reports! This section assumes that you have already succeeded in Building OpenJFX. A gradle build must complete before IDE support will fully work (otherwise your IDE will just be a glorified text editor with lots of red squiggles!). Specific instructions for using each IDE is provided below, followed by a discussion on Developer Workflow, Using Mercurial, and Communication with other members of the team. Further information on how we work can be found under Co de Style Rules. IDE Pre-Requirements Get a build of the latest JDK Get an IDE that supports the latest JDK JDK-8 Only: Delete jfxrt.jar (or move it to a different directory) Using NetBeans (JDK-8) Invoke NetBeans Add the JDK8 Platform Import the NetBeans Projects Rebuild Run Sample Code Run Sample Code with gradle built shared libraries Using IntelliJ IDEA Open the IntelliJ Project Make Run Sample Code Run Sample Code with Gradle Built Shared Libraries Using Eclipse Import the Eclipse Projects Configure Eclipse to use the latest JDK JUnit tests Running a dependent project Run Sample Code (NOTE: old) Using Gradle Run Sample Code with Gradle Built Shared Libraries (Note: old) IDE Pre-Requirements Despite the fact that most of the major IDE's support gradle directly, we have decided to provide pre-generated IDE configuration files in order to make using an IDE smooth and painless.
    [Show full text]
  • Advanced Programming Language Design (Raphael A. Finkel)
    See discussions, stats, and author profiles for this publication at: https://www.researchgate.net/publication/220692467 Advanced programming language design. Book · January 1996 Source: DBLP CITATIONS READS 41 3,040 1 author: Raphael Finkel University of Kentucky 122 PUBLICATIONS 6,757 CITATIONS SEE PROFILE All content following this page was uploaded by Raphael Finkel on 16 December 2013. The user has requested enhancement of the downloaded file. ADVANCED PROGRAMMING LANGUAGE DESIGN Raphael A. Finkel ❖ UNIVERSITY OF KENTUCKY ▲ ▼▼ Addison-Wesley Publishing Company Menlo Park, California · Reading, Massachusetts New York · Don Mills, Ontario · Harlow, U.K. · Amsterdam Bonn · Paris · Milan · Madrid · Sydney · Singapore · Tokyo Seoul · Taipei · Mexico City · San Juan, Puerto Rico hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh On-line edition copyright 1996 by Addison-Wesley Publishing Company. Permission is granted to print or photo- copy this document for a fee of $0.02 per page, per copy, payable to Addison-Wesley Publishing Company. All other rights reserved. Acquisitions Editor: J. Carter Shanklin Proofreader: Holly McLean-Aldis Editorial Assistant: Christine Kulke Text Designer: Peter Vacek, Eigentype Senior Production Editor: Teri Holden Film Preparation: Lazer Touch, Inc. Copy Editor: Nick Murray Cover Designer: Yvo Riezebos Manufacturing Coordinator: Janet Weaver Printer: The Maple-Vail Book Manufacturing Group Composition and Film Coordinator: Vivian McDougal Copyright 1996 by Addison-Wesley Publishing Company All rights reserved. No part of this publication may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, or any other media embodiments now known, or hereafter to become known, without the prior written permission of the publisher.
    [Show full text]
  • IBM Visualage C++ for AIX Offers a Traditional Makefile-Based Compiler
    Software Announcement March 28, 2000 IBM VisualAge C++ for AIX Offers a Traditional Makefile-based Compiler Overview AIX) for the editing function within the integrated development At a Glance The VisualAge C++ Professional environment (IDE) for AIX , Version 5.0 software is a VisualAge C++ Professional for • Support for multiple code stores highly productive, and powerful AIX, Version 5.0 is a powerful within the incremental compiler development environment for application development allowing a large project to be building C and C++ applications. environment that includes: implemented in separate and VisualAge C++ Professional offers smaller units • the flexibility of a set of C++ Incredible flexibility with the choice of a traditional, compilers supported by a suite of • Easier transition from the makefile-based C++ compiler tools designed to offer a rich incremental compiler to the or the highly productive IBM environment for object-oriented traditional compiler with the incremental C++ compiler application development. ordered name lookup option, which allows the compiler to try • Support for the latest ANSI 98 VisualAge C++ Professional for AIX to resolve all names to the same C++ standards in both now includes a traditional, declarations that a traditional compilers, including a complete makefile-based C++ compiler. This compiler would ANSI Standard Template makefile-based compiler supports Library the latest 1998 ANSI/ISO C++ • More flexible source control with standard and includes a complete the ability to check files into or • Support for 32-bit and 64-bit implementation of the ANSI Standard out of virtually any source control optimization in both compilers Template Library (STL).
    [Show full text]
  • Insights on Motivations and Design a Transpiler from Java to Javascript
    JSweet: insights on motivations and design A transpiler from Java to JavaScript Renaud Pawlak [email protected] http://www.jsweet.org November 16, 2015 Abstract In this position paper, we present JSweet, a Java to JavaScript transpiler, which motivations originate in that its design takes advantage of the TypeScript transpiler to generate sound JavaScript code and APIs. We explain how JSweet uses the TSD repository to automatically generate all the JavaScript frameworks and libraries APIs in Java, so that they can be directly used from any JSweet-enabled Java pro- gram. We also explain how JSweet implements a two-layer design that allows Java and TypeScript to double-check the programs against the APIs. This double veri- fication ensures that the source and transpiled programs are rigorously equivalent. We illustrate the capabilities of JSweet with two simple examples, showing the original and transpiled codes. 1 What is JSweet and why did we do it? In the past few years, many source-to-source compilers (a.k.a transpilers) have been created to improve JavaScript. Among them, the most well-known are CoffeeScript [9], Dart [17], and TypeScript [11], but the list of such languages is much longer. Tran- spilers have become such an attractive alternative for programming Web applications, that some initiatives such as GPM [7] have raised to standardize the transpilation pro- cess in ECMAScript 6. Most transpilers over JavaScript propose a new syntax (Coffee- Script, Dart), or a syntax extension to JavaScript (TypeScript). Some approaches, such as Hop for Haskell [8] and the OCaml bytecode translator [19], propose to start from an existing language.
    [Show full text]