[PDF] [PDF] Static TypeScript - Microsoft

By design, Type- Script provides no type soundness guarantees Object types provide a unification of maps, functions, and classes; struc- tural subtyping between 



Previous PDF Next PDF





[PDF] Static TypeScript - Microsoft

By design, Type- Script provides no type soundness guarantees Object types provide a unification of maps, functions, and classes; struc- tural subtyping between 



[PDF] This copy of the TypeScript handbook was created on Wednesday

Generating mapping types which change properties via template The goal of TypeScript is to be a static typechecker for JavaScript programs TypeScript is telling us we forgot to pass an argument to the greet function, and rightfully so So



[PDF] Angular 2 static variable in template - Squarespace

How do I bind a static component variable to an HTML element in angular 2? { follows - Static variables and methods in Typescript – Techformist, Static 



[PDF] Concrete Types for TypeScript - Jan Vitek

former have a TypeScript-like semantics, variables typed with concrete types are The function pdist will invoke dist at static types Point, yet it is invoked with a 



[PDF] TypeScript Language Specification - ECMA-262

TypeScript is a trademark of Microsoft Corporation Generic Types and Functions Static class members become properties of the class constructor



[PDF] TypeScript for OO Developers - PUG Challenge Americas

Static properties ○ Static methods ○ Static classes can be created by throwing an error in the constructor ○ RUNTIME only though class MyClass {



[PDF] Checking Correctness of TypeScript Interfaces for JavaScript Libraries

pass static type checking, it is possible that a variable at run- time has a value that does eign function interface as known from other programming languages



[PDF] Static Typing of Complex Presence Constraints in Interfaces - DROPS

Many functions in libraries and APIs have the notion of optional parameters, As opposed to TypeScript and many other languages — where properties are 



[PDF] Concrete Types for TypeScript - PLG

8 juil 2014 · The divide between static and dynamic types has fascinated aca- demics and dist(p: Pt); } Interfaces can include properties and methods



[PDF] Safe & Efficient Gradual Typing for TypeScript - Cs Umd - University

Our compiler achieves soundness by enforcing stricter static checks and embedding TypeScript adds an object-oriented gradual type system, while its method In TypeScript, all types are interpreted structurally: Point and MovablePoint are 

[PDF] static scope java

[PDF] static type vs dynamic typed language

[PDF] static variable in c programming language

[PDF] static variable stack in c

[PDF] static variable using c program

[PDF] static variables java

[PDF] static vs dynamic exercise blood pressure

[PDF] static vs dynamic type java

[PDF] static vs dynamic typing

[PDF] statics problems and solutions pdf

[PDF] statistical analysis: microsoft excel 2016 pdf

[PDF] statistical measures of similarity

[PDF] statistics

[PDF] statistics 101 pdf

[PDF] statistics 13v

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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
5556
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109

110Static TypeScript

An Implementation of a Static Compiler for the TypeScript Language

Thomas Ball

Microsoft Research

Redmond, WA, United States

tball@microso?.comPeli de Halleux

Microsoft Research

Redmond, WA, United States

jhalleux@microso?.comMichał Moskal

Microsoft Research

Redmond, WA, United States

mimoskal@microso?.com AbstractWhile the programming of microcontroller-based embed- dable devices typically is the realm of the C language, such devices are now ?nding 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 com- piler/linker toolchain, which is implemented fully in Type- Script and runs in the web browser. STS is designed to be use- 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 ex- ecutable that is more e?cient 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.

Keywords

JavaScript, TypeScript, compiler, interpreter, mi- crocontrollers, virtual machine

1 Introduction

Recently, physical computing has been making headway in the classroom, engaging children to build simple interactive embedded systems. For example, Figure 1(a) shows the BBC micro:bit [1], a small programmable Arduino-inspired com- puter with an integrated 5x5 LED display, several sensors and Bluetooth Low Energy (BLE) radio technology. The de- vice ?rst rolled out in 2015 to all year 7 students (age 10 to

11) in the UK and has since gone global, with four million

units distributed worldwide to date via the micro:bit Educa- tion Foundation (h?ps://microbit.org). Figure 1(b) shows a di?erent educational device featuring RGB LEDs: Adafruit"s

Circuit Playground Express (CPX).

Research suggests that using such devices in computer science education increases engagement, especially amongMPLR 2019, Under submission, .(a) (b)

Figure1.

devices: (a) the BBC micro:bit has a Nordic nRF51822 MCU with 16 kB RAM and 256 kB ?ash; (b) Adafruit"s Circuit Play- ground Express (h?ps://adafruit.com/products/3333) has an

Atmel SAMD21 MCU with 32 kB RAM and 256 kB ?ash.

girls, increases con?dence in both students and teachers, and makes lessons more fun [2, 16]. To keep costs low for schools, these devices typically em- ploy 32 bit ARM Cortex-M microcontrollers (MCUs) with

16-256kB of RAM and are programmed using an external

computer (usually a laptop or desktop). Programming such devices in a classroom presents a number of technical chal- lenges: (1) the selection/design of an age-appropriate program- ming language and environment; (2) classroom computers running outdated operating sys- tems, having intermittent and slow internet connec- tivity, and locked down by school IT administrators, which makes native app installation di?cult; (3) the transfer of the student"s program from the com- puter to the device, where it can run on battery power (as many projects embed the device in an experiment or "make"). With respect to these challenges, there are various embed- ded interpreters for popular scripting languages, such as JavaScript (JerryScript [8,15], Duktape [22], Espruino [23], mJS [20], and MuJS [19]) and Python (MicroPython [9] and its fork CircuitPython [12]). The interpreters run directly on host computer, but forego the bene?ts of advanced optimiz- ing JIT compilers (such as V8) that require about two orders of magnitude more memory than is available on MCUs. 1 111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164

165MPLR 2019, Under submission, Thomas Ball, Peli de Halleux, and Michał Moskal

166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219

160x120 color screens. These boards use ARM"s Cortex-M4F

core: the ATSAMD51G19 (192kB RAM, running at 120Mhz) and STM32F401RE (96kB RAM, running at 84Mhz). Unfortunately, such embedded interpreters are between one and three orders of magnitude slower than V8 (see Sec- tion 4), a?ecting responsiveness and battery life. Even more importantly, due to the representation of objects in memory as dynamic key-value mappings, the memory footprint can be several times that of an equivalent C program. This can severely limit the applications that can be deployed on low- memory devices such as the micro:bit (16 kB RAM) and CPX (32 kB RAM).

1.1 Static TypeScript

As an alternative to embedded interpreters, we present Static TypeScript (STS), a syntactic subset of TypeScript,[3] sup- ported by a compiler (written in TypeScript) that generates machine code that runs e?ciently on MCUs in the target RAM range of 16-256kB. The design of STS and its compiler three challenges. In particular: STS eliminates most of the "bad parts" of JavaScript; following StrongScript [14], STS uses nominal typing for statically declared classes and supports e?cient compilation of classes using classic techniques for v-quotesdbs_dbs22.pdfusesText_28