@@ -128,15 +128,15 @@ <h2 id="lexing">Lexing</h2>
128
128
< ul >
129
129
< li >
130
130
< p >
131
- < i > id</ i > : Matched by < tt > [_a-zA-Z][_a-zA-Z0-9]*</ tt >
131
+ < i > id</ i > : Matched by < tt > [_a-zA-Z][_a-zA-Z0-9]*</ tt > .
132
132
</ p >
133
133
< p >
134
134
Some identifiers are reserved as keywords, thus are not in the set < i > id</ i > :
135
135
< code > assert</ code > < code > else</ code > < code > error</ code > < code > false</ code >
136
136
< code > for</ code > < code > function</ code > < code > if</ code > < code > import</ code >
137
137
< code > importstr</ code > < code > in</ code > < code > local</ code > < code > null</ code >
138
138
< code > tailstrict</ code > < code > then</ code > < code > self</ code > < code > super</ code >
139
- < code > true</ code >
139
+ < code > true</ code > .
140
140
</ p >
141
141
</ li >
142
142
< li >
@@ -205,25 +205,25 @@ <h2 id="lexing">Lexing</h2>
205
205
< li >
206
206
< p >
207
207
< i > operator</ i > : A sequence of at least one of the following single-character symbols:
208
- < code > !$:~+-&|^=<>*/%</ code >
208
+ < code > !$:~+-&|^=<>*/%</ code > .
209
209
</ p >
210
210
< p >
211
- Subject to the following rules, which will cause the lexing to terminate with a shorter
211
+ Additionally it is subject to the following rules, which may cause the lexing to terminate with a shorter
212
212
token:
213
213
</ p >
214
214
< ul >
215
215
< li >
216
- The sequence < code > //</ code > is not allowed in an operator
216
+ The sequence < code > //</ code > is not allowed in an operator.
217
217
</ li >
218
218
< li >
219
- The sequence < code > /*</ code > is not allowed in an operator
219
+ The sequence < code > /*</ code > is not allowed in an operator.
220
220
</ li >
221
221
< li >
222
- The sequence < code > |||</ code > is not allowed in an operator
222
+ The sequence < code > |||</ code > is not allowed in an operator.
223
223
</ li >
224
224
< li >
225
225
If the sequence has more than one character, it is not allowed to end in any of
226
- < code > +-~! $</ code >
226
+ < code > +</ code > , < code > - </ code > , < code > ~ </ code > , < code > ! </ code > , < code > $</ code > .
227
227
</ li >
228
228
</ ul >
229
229
</ li >
@@ -299,7 +299,7 @@ <h2 id="abstract_syntax">Abstract Syntax</h2>
299
299
[ < i > expr</ i > { < code > ,</ code > < i > expr</ i > } [ < code > ,</ code > ] ]
300
300
< code > ]</ code >
301
301
</ td >
302
- </ tr >
302
+ </ tr >
303
303
304
304
<!-- array comprehension -->
305
305
< tr >
@@ -332,21 +332,8 @@ <h2 id="abstract_syntax">Abstract Syntax</h2>
332
332
< td >
333
333
< i > expr</ i >
334
334
< code > [</ code >
335
- < i > expr</ i >
336
- [ < code > :</ code > [ < i > expr</ i >
337
- [ < code > :</ code > [ < i > expr</ i > ] ] ] ]
338
- < code > ]</ code >
339
- </ td >
340
- </ tr >
341
-
342
- <!-- object index (general2) -->
343
- < tr >
344
- < td > </ td >
345
- < td > | </ td >
346
- < td >
347
- < i > expr</ i >
348
- < code > [</ code >
349
- < code > :</ code > [ < i > expr</ i >
335
+ [ < i > expr</ i > ]
336
+ [ < code > :</ code > [ < i > expr</ i > ]
350
337
[ < code > :</ code > [ < i > expr</ i > ] ] ]
351
338
< code > ]</ code >
352
339
</ td >
@@ -549,7 +536,7 @@ <h2 id="abstract_syntax">Abstract Syntax</h2>
549
536
< code > ]</ code >
550
537
< code > :</ code >
551
538
< i > expr</ i >
552
- [ { < code > ,</ code > < i > objlocal</ i > } ] [ < code > ,</ code > ]
539
+ [ { < code > ,</ code > < i > objlocal</ i > } ] [ < code > ,</ code > ]
553
540
< i > forspec</ i > < i > compspec</ i >
554
541
</ td >
555
542
</ tr >
@@ -882,10 +869,6 @@ <h3 id="core_syntax">Core Syntax</h3>
882
869
The following binary operators are removed: < code > !=</ code > < code > ==</ code > < code > %</ code >
883
870
< code > in</ code >
884
871
</ li >
885
- < li >
886
- All function parameters must now have default arguments. To simulate a parameter that
887
- must be bound at the call site, use a default argument that evaluates to an error.
888
- </ li >
889
872
< li > Array slices < code > [::]</ code > are removed.</ li >
890
873
< li >
891
874
Array and object comprehensions are replaced with a simple object comprehension construct.
@@ -1177,9 +1160,9 @@ <h3 id="desugaring">Desugaring</h3>
1177
1160
\textrm{ be the sequence of variables defined in }forspec\ compspec \\
1178
1161
1179
1162
\hspace{10mm} \object{ \\
1180
- \hspace{20mm} [desugar_{expr}(\local{x_1=arr[1 ] \ldots x_n=arr[n]}{e_f}, b)]: \\
1163
+ \hspace{20mm} [desugar_{expr}(\local{x_1=arr[0 ] \ldots x_n=arr[n-1 ]}{e_f}, b)]: \\
1181
1164
\hspace{30mm} desugar_{expr}(
1182
- \local{x_1=arr[1 ] \ldots x_n=arr[n]}{
1165
+ \local{x_1=arr[0 ] \ldots x_n=arr[n-1 ]}{
1183
1166
\local{bind_1 \ldots bind_n}{e_{body}}
1184
1167
}, true) \\
1185
1168
\hspace{20mm} \textrm{ for } arr \textrm{ in }
@@ -1349,74 +1332,74 @@ <h3 id="desugaring">Desugaring</h3>
1349
1332
</ div >
1350
1333
< div class ="desugar-rule-group ">
1351
1334
< p >
1352
- < i > desugar< sub > assert</ sub > </ i > : (Field × Boolean ) → Field. This desugars object
1335
+ < i > desugar< sub > assert</ sub > </ i > : (Field × [Bind] ) → Field. This desugars object
1353
1336
assertions.
1354
1337
</ p >
1355
1338
< div class ="desugar-rule ">
1356
1339
\[
1357
- desugar_{assert}(\assert e) , binds) =
1340
+ desugar_{assert}(\assert e, binds) =
1358
1341
desugar_{assert}(\assert e : \texttt{"Assertion failed"}, binds)
1359
1342
\]
1360
1343
</ div >
1361
1344
< div class ="desugar-rule ">
1362
1345
\[
1363
- desugar_{assert}(\assert e : e') , binds) =
1346
+ desugar_{assert}(\assert e : e', binds) =
1364
1347
\assert{desugar_{expr}(\local{binds}{\if{e}{\null}{\error{e'}}}, \true)}
1365
1348
\]
1366
1349
</ div >
1367
1350
</ div >
1368
1351
< div class ="desugar-rule-group ">
1369
1352
< p >
1370
- < i > desugar< sub > field</ sub > </ i > : (Field × Boolean) → Field. This desugars object fields.
1353
+ < i > desugar< sub > field</ sub > </ i > : (Field × [Bind] × Boolean) → Field. This desugars object fields.
1371
1354
Recall that < i > h</ i > ranges over < code > :</ code > , < code > ::</ code > , < code > :::</ code > . The
1372
1355
boolean records whether the object containing this field is itself in another object. The
1373
1356
notation < i > string(id)</ i > means converting the identifier token to a string literal.
1374
1357
</ p >
1375
1358
< div class ="desugar-rule ">
1376
1359
\[
1377
- desugar_{field}(id \mathrel{h} e) , binds, b) =
1360
+ desugar_{field}(id \mathrel{h} e, binds, b) =
1378
1361
desugar_{field}([string(id)] \mathrel{h} e), binds, b)
1379
1362
\]
1380
1363
</ div >
1381
1364
< div class ="desugar-rule ">
1382
1365
\[
1383
- desugar_{field}(id \mathrel{+h} e) , binds, b) =
1366
+ desugar_{field}(id \mathrel{+h} e, binds, b) =
1384
1367
desugar_{field}([string(id)] \mathrel{+h} e), binds, b)
1385
1368
\]
1386
1369
</ div >
1387
1370
< div class ="desugar-rule ">
1388
1371
\[
1389
- desugar_{field}(id(params) \mathrel{h} e) , binds, b) =
1372
+ desugar_{field}(id(params) \mathrel{h} e, binds, b) =
1390
1373
desugar_{field}([string(id)](params) \mathrel{h} e), binds, b)
1391
1374
\]
1392
1375
</ div >
1393
1376
< div class ="desugar-rule ">
1394
1377
\[
1395
- desugar_{field}(string \mathrel{h} e) , binds, b) =
1378
+ desugar_{field}(string \mathrel{h} e, binds, b) =
1396
1379
desugar_{field}([string] \mathrel{h} e), binds, b)
1397
1380
\]
1398
1381
</ div >
1399
1382
< div class ="desugar-rule ">
1400
1383
\[
1401
- desugar_{field}(string \mathrel{+h} e) , binds, b) =
1384
+ desugar_{field}(string \mathrel{+h} e, binds, b) =
1402
1385
desugar_{field}([string] \mathrel{+h} e), binds, b)
1403
1386
\]
1404
1387
</ div >
1405
1388
< div class ="desugar-rule ">
1406
1389
\[
1407
- desugar_{field}(string(params) \mathrel{h} e) , binds, b) =
1390
+ desugar_{field}(string(params) \mathrel{h} e, binds, b) =
1408
1391
desugar_{field}([string](params) \mathrel{h} e), binds, b)
1409
1392
\]
1410
1393
</ div >
1411
1394
< div class ="desugar-rule ">
1412
1395
\[
1413
- desugar_{field}([e] \mathrel{h} e') , binds, b) =
1396
+ desugar_{field}([e] \mathrel{h} e', binds, b) =
1414
1397
[desugar_{expr}(e, b)] \mathrel{h} desugar_{expr}(\local{binds}{e}, \true)
1415
1398
\]
1416
1399
</ div >
1417
1400
< div class ="desugar-rule ">
1418
1401
\[
1419
- desugar_{field}([e] \mathrel{+h} e') , binds, b) = \\
1402
+ desugar_{field}([e] \mathrel{+h} e', binds, b) = \\
1420
1403
\hspace{10mm}
1421
1404
\textrm{let } e'' = e[\texttt{\$outerself} / \self, \texttt{\$outersuper} / \super] \\
1422
1405
\hspace{10mm}
@@ -1427,14 +1410,14 @@ <h3 id="desugaring">Desugaring</h3>
1427
1410
</ div >
1428
1411
< div class ="desugar-rule ">
1429
1412
\[
1430
- desugar_{field}([e](params) \mathrel{h} e') , binds, b) =
1413
+ desugar_{field}([e](params) \mathrel{h} e', binds, b) =
1431
1414
desugar_{field}([e] \mathrel{h} \function{params}{e'}, binds, b)
1432
1415
\]
1433
1416
</ div >
1434
1417
</ div >
1435
1418
< div class ="desugar-rule-group ">
1436
1419
< p >
1437
- < i > desugar< sub > bind</ sub > </ i > : (Field × Boolean) → Field. This desugars local bindings.
1420
+ < i > desugar< sub > bind</ sub > </ i > : (Bind × Boolean) → Field. This desugars local bindings.
1438
1421
</ p >
1439
1422
< div class ="desugar-rule ">
1440
1423
\[
@@ -1474,7 +1457,7 @@ <h3 id="desugaring">Desugaring</h3>
1474
1457
< div class ="desugar-rule ">
1475
1458
\[
1476
1459
desugar_{arrcomp}(e, \textrm{if }e'\ compspec, b) =
1477
- desugar_{expr}(\if{e'}{[ desugar_{arrcomp}(e, compspec, b)] }{[\ ]}, b)
1460
+ desugar_{expr}(\if{e'}{desugar_{arrcomp}(e, compspec, b)}{[\ ]}, b)
1478
1461
\]
1479
1462
</ div >
1480
1463
< div class ="desugar-rule ">
@@ -1491,7 +1474,7 @@ <h3 id="desugaring">Desugaring</h3>
1491
1474
\local{arr = e'}{
1492
1475
\texttt{std.join}(\\\hspace{20mm}[\ ], \texttt{std.makeArray}(
1493
1476
\texttt{std.length}(arr),
1494
- \function{i}{\local{x = arr[i]}{[ desugar_{arrcomp}(e, compspec, b)] }}
1477
+ \function{i}{\local{x = arr[i]}{desugar_{arrcomp}(e, compspec, b)}}
1495
1478
))
1496
1479
},
1497
1480
b
@@ -1506,7 +1489,7 @@ <h3 id="desugaring">Desugaring</h3>
1506
1489
\local{arr = e'}{
1507
1490
\texttt{std.join}(\\\hspace{20mm}[\ ], \texttt{std.makeArray}(
1508
1491
\texttt{std.length}(arr),
1509
- \function{i}{\local{x = arr[i]}{[base ]}}
1492
+ \function{i}{\local{x = arr[i]}{[e ]}}
1510
1493
))
1511
1494
},
1512
1495
b
0 commit comments