Static TypeScript: an implementation of a static compiler for the TypeScript language | Proceedings of the 16th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes (original) (raw)
Published: 21 October 2019 Publication History
Abstract
While the programming of microcontroller-based embeddable devices typically is the realm of the C language, such devices are now finding their way into the classroom for CS education, even at the level of middle school. As a result, the use of scripting languages (such as JavaScript and Python) for microcontrollers is on the rise.
We present Static TypeScript (STS), a subset of TypeScript (itself, a gradually typed superset of JavaScript), and its compiler/linker toolchain, which is implemented fully in TypeScript and runs in the web browser. STS is designed to be useful in practice (especially in education), while being amenable to static compilation targeting small devices. A user’s STS program is compiled to machine code in the browser and linked against a precompiled C++ runtime, producing an executable that is more efficient than the prevalent embedded interpreter approach, extending battery life and making it possible to run on devices with as little as 16 kB of RAM (such as the BBC micro:bit).
This paper is primarily a description of the STS system and the technical challenges of implementing embedded programming platforms in the classroom.
References
[1]
Jonny Austin, Howard Baker, Thomas Ball, James Devine, Joe Finney, Peli de Halleux, Steve Hodges, Michal Moskal, and Gareth Stockdale. 2019. The BBC micro:bit – from the UK to the World. Commun. ACM (to appear) (2019).
[2]
BBC. 2017. BBC micro:bit celebrates huge impact in first year, with 90% of students saying it helped show that anyone can code. https: //www.bbc.co.uk/mediacentre/latestnews/2017/microbit-first-year .
[3]
Gavin M. Bierman, Martín Abadi, and Mads Torgersen. 2014. Understanding TypeScript. In ECOOP 2014 - Object-Oriented Programming -28th European Conference, Uppsala, Sweden, July 28 - August 1, 2014. Proceedings. 257–281.
[4]
Hans-J Boehm, Russ Atkinson, and Michael Plass. 1995. Ropes: an alternative to strings. Software: Practice and Experience 25, 12 (1995), 1315–1330.
[5]
Satish Chandra, Colin S. Gordon, Jean-Baptiste Jeannin, Cole Schlesinger, Manu Sridharan, Frank Tip, and Young-Il Choi. 2016. Type inference for static compilation of JavaScript. In Proceedings of the 2016 ACM SIGPLAN International Conference on Object-Oriented Programming, Systems, Languages, and Applications, OOPSLA 2016, part of SPLASH 2016, Amsterdam, The Netherlands, October 30 - November 4, 2016. 410–429.
[6]
Wontae Choi, Satish Chandra, George Necula, and Koushik Sen. 2015. SJS: A type system for JavaScript with fixed object layout. In International Static Analysis Symposium. Springer, 181–198.
[7]
James Devine, Joe Finney, Peli de Halleux, Michal Moskal, Thomas Ball, and Steve Hodges. 2018. MakeCode and CODAL: intuitive and efficient embedded systems programming for education. In Proceedings of the 19th ACM SIGPLAN/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems, LCTES 2018, Philadelphia, PA, USA, June 19-20, 2018. 19–30.
[8]
Evgeny Gavrin, Sung-Jae Lee, Ruben Ayrapetyan, and Andrey Shitov. 2015. Ultra Lightweight JavaScript Engine for Internet of Things. In SPLASH Companion 2015. 19–20.
[9]
Damien George. 2018. MicroPython. http://www.micropython.org .
[10]
Isaac Gouy. 2018. The Computer Language Benchmarks Game. https: //benchmarksgame-team.pages.debian.net/benchmarksgame/ .
[11]
Apple Inc. 2018. JetStream Benchmarks 1.1. https://www. browserbench.org/JetStream/in-depth.html .
[12]
Adafruit Industries. 2018. CircuitPython. https://github.com/adafruit/ circuitpython .
[13]
A. Rastogi, N. Swamy, C. Fournet, G. M. Bierman, and P. Vekris. 2015. Safe & Efficient Gradual Typing for TypeScript. In Proceedings of the 42nd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages. 167–180.
[14]
G. Richards, F. Z. Nardelli, and J. Vitek. 2015. Concrete Types for TypeScript. In 29th European Conference on Object-Oriented Programming, ECOOP 2015. 76–100.
[15]
Samsung. 2018. JerryScript. http://jerryscript.org .
[16]
Sue Sentance, Jane Waite, Steve Hodges, Emily MacLeod, and Lucy Yeomans. 2017. "Creating Cool Stuff": Pupils’ Experience of the BBC Micro:Bit. In Proceedings of the 2017 ACM SIGCSE Technical Symposium on Computer Science Education (SIGCSE ’17). ACM, 531–536.
[17]
Manuel Serrano. 2018. JavaScript AOT compilation. In Proceedings of the 14th ACM SIGPLAN International Symposium on Dynamic Languages. ACM, 50–63.
[18]
Jeremy G. Siek and Walid Taha. 2007. Gradual Typing for Objects. In ECOOP 2007 - Object-Oriented Programming, 21st European Conference, Berlin, Germany, July 30 - August 3, 2007, Proceedings. 2–27.
[19]
Artifex Software. 2018. MuJS. https://mujs.com/ .
[20]
Cesanta Software. 2018. mJS. https://github.com/cesanta/mjs .
[21]
Patrick Soquet. 2017. XS7. https://www.moddable.com/XS7-TC-39 .
[22]
Sami Vaarala. 2018. DukTape. https://duktape.org/ .
[23]
Gordon Williams. 2017. Making Things Smart: Easy Embedded JavaScript Programming for Making Everyday Objects into Intelligent Machines. Maker Media.
Information & Contributors
Information
Published In
MPLR 2019: Proceedings of the 16th ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes
October 2019
171 pages
Copyright © 2019 ACM.
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].
Publisher
Association for Computing Machinery
New York, NY, United States
Publication History
Published: 21 October 2019
Permissions
Request permissions for this article.
Check for updates
Author Tags
Qualifiers
- Research-article
Conference
Upcoming Conference
Contributors
Other Metrics
Bibliometrics & Citations
Bibliometrics
Article Metrics
- View Citations
- Downloads (Last 12 months)55
- Downloads (Last 6 weeks)11
Reflects downloads up to 14 Nov 2024
Other Metrics
Citations
- Suzuki GWatanabe TMoriguchi SErtl MKirsch C(2024)mruby on Resource-Constrained Low-Power Coprocessors of Embedded DevicesProceedings of the 21st ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3679007.3685064(41-47)Online publication date: 13-Sep-2024
- Mochizuki FYamazaki TChiba SErtl MKirsch C(2024)Interactive Programming for Microcontrollers by Offloading Dynamic Incremental CompilationProceedings of the 21st ACM SIGPLAN International Conference on Managed Programming Languages and Runtimes10.1145/3679007.3685062(28-40)Online publication date: 13-Sep-2024
- Kraemer CGelder WHester J(2024)User-directed Assembly Code Transformations Enabling Efficient Batteryless Arduino ApplicationsProceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies10.1145/36595908:2(1-32)Online publication date: 15-May-2024
- Ball Tde Halleux PDevine JHodges SMoskal M(2024)Jacdac: Service-Based Prototyping of Embedded SystemsProceedings of the ACM on Programming Languages10.1145/36564058:PLDI(692-715)Online publication date: 20-Jun-2024
- Inoue AUgawa TChiba SBond MLee JPayer H(2024)A Managed Memory System for Micro Controllers with NOR Flash MemoryProceedings of the 2024 ACM SIGPLAN International Symposium on Memory Management10.1145/3652024.3665511(57-67)Online publication date: 20-Jun-2024
- Sesha PBairagi SAbhishek KYadav DBharati R(2023)EzLang: A C Based Programming Language2023 7th International Conference On Computing, Communication, Control And Automation (ICCUBEA)10.1109/ICCUBEA58933.2023.10392258(1-5)Online publication date: 18-Aug-2023
- Yu XTang WXiong TChen WHe JYang BQi Z(2023)Enhancing embedded systems development with TSAutomated Software Engineering10.1007/s10515-023-00404-x31:1Online publication date: 6-Dec-2023
- Devine JMoskal Mde Halleux PBall THodges SD'Amone GGakure DFinney JUnderwood LHartley KKos POppenheim M(2022)Plug-and-play Physical Computing with JacdacProceedings of the ACM on Interactive, Mobile, Wearable and Ubiquitous Technologies10.1145/35503176:3(1-30)Online publication date: 7-Sep-2022
- Serrano M(2021)Of JavaScript AOT compilation performanceProceedings of the ACM on Programming Languages10.1145/34735755:ICFP(1-30)Online publication date: 19-Aug-2021
- Moskal MBall TChatra ADevine Jde Halleux PHodges SKao SKnoll RNickel GRussell JWunderlich JZuniga D(2021)Web-based Programming for Low-cost Gaming HandheldsProceedings of the 16th International Conference on the Foundations of Digital Games10.1145/3472538.3472572(1-12)Online publication date: 3-Aug-2021
- Show More Cited By
View Options
Get Access
Login options
Check if you have access through your login credentials or your institution to get full access on this article.
Full Access
View options
View or Download as a PDF file.
eReader
View online with eReader.
Media
Figures
Other
Tables
Affiliations
Thomas Ball
Peli de Halleux
Michał Moskal