plum
git clone https://git.pyrossh.dev/plum
A statically typed, imperative programming language inspired by rust, python
27426a3
— Peter John
2023-05-01T13:56:23+05:30
fix tests
Generated files not shown: src/parser.c
- grammar.js +2 -2
- src/grammar.json +8 -0
- src/node-types.json +104 -0
- test/corpus/functions.txt +26 -9
grammar.js
CHANGED
|
@@ -152,8 +152,8 @@ module.exports = grammar({
|
|
|
152
152
|
// $.assert,
|
|
153
153
|
$.negation,
|
|
154
154
|
$.record_update,
|
|
155
|
-
|
|
155
|
+
$.field_access,
|
|
156
|
-
|
|
156
|
+
$.function_call
|
|
157
157
|
),
|
|
158
158
|
record: ($) =>
|
|
159
159
|
seq(
|
src/grammar.json
CHANGED
|
@@ -2026,6 +2026,14 @@
|
|
|
2026
2026
|
{
|
|
2027
2027
|
"type": "SYMBOL",
|
|
2028
2028
|
"name": "record_update"
|
|
2029
|
+
},
|
|
2030
|
+
{
|
|
2031
|
+
"type": "SYMBOL",
|
|
2032
|
+
"name": "field_access"
|
|
2033
|
+
},
|
|
2034
|
+
{
|
|
2035
|
+
"type": "SYMBOL",
|
|
2036
|
+
"name": "function_call"
|
|
2029
2037
|
}
|
|
2030
2038
|
]
|
|
2031
2039
|
},
|
src/node-types.json
CHANGED
|
@@ -73,10 +73,18 @@
|
|
|
73
73
|
"type": "expression_group",
|
|
74
74
|
"named": true
|
|
75
75
|
},
|
|
76
|
+
{
|
|
77
|
+
"type": "field_access",
|
|
78
|
+
"named": true
|
|
79
|
+
},
|
|
76
80
|
{
|
|
77
81
|
"type": "float",
|
|
78
82
|
"named": true
|
|
79
83
|
},
|
|
84
|
+
{
|
|
85
|
+
"type": "function_call",
|
|
86
|
+
"named": true
|
|
87
|
+
},
|
|
80
88
|
{
|
|
81
89
|
"type": "hole",
|
|
82
90
|
"named": true
|
|
@@ -152,10 +160,18 @@
|
|
|
152
160
|
"type": "expression_group",
|
|
153
161
|
"named": true
|
|
154
162
|
},
|
|
163
|
+
{
|
|
164
|
+
"type": "field_access",
|
|
165
|
+
"named": true
|
|
166
|
+
},
|
|
155
167
|
{
|
|
156
168
|
"type": "float",
|
|
157
169
|
"named": true
|
|
158
170
|
},
|
|
171
|
+
{
|
|
172
|
+
"type": "function_call",
|
|
173
|
+
"named": true
|
|
174
|
+
},
|
|
159
175
|
{
|
|
160
176
|
"type": "identifier",
|
|
161
177
|
"named": true
|
|
@@ -272,10 +288,18 @@
|
|
|
272
288
|
"type": "expression_group",
|
|
273
289
|
"named": true
|
|
274
290
|
},
|
|
291
|
+
{
|
|
292
|
+
"type": "field_access",
|
|
293
|
+
"named": true
|
|
294
|
+
},
|
|
275
295
|
{
|
|
276
296
|
"type": "float",
|
|
277
297
|
"named": true
|
|
278
298
|
},
|
|
299
|
+
{
|
|
300
|
+
"type": "function_call",
|
|
301
|
+
"named": true
|
|
302
|
+
},
|
|
279
303
|
{
|
|
280
304
|
"type": "identifier",
|
|
281
305
|
"named": true
|
|
@@ -1171,10 +1195,18 @@
|
|
|
1171
1195
|
"type": "expression_group",
|
|
1172
1196
|
"named": true
|
|
1173
1197
|
},
|
|
1198
|
+
{
|
|
1199
|
+
"type": "field_access",
|
|
1200
|
+
"named": true
|
|
1201
|
+
},
|
|
1174
1202
|
{
|
|
1175
1203
|
"type": "float",
|
|
1176
1204
|
"named": true
|
|
1177
1205
|
},
|
|
1206
|
+
{
|
|
1207
|
+
"type": "function_call",
|
|
1208
|
+
"named": true
|
|
1209
|
+
},
|
|
1178
1210
|
{
|
|
1179
1211
|
"type": "identifier",
|
|
1180
1212
|
"named": true
|
|
@@ -1318,10 +1350,18 @@
|
|
|
1318
1350
|
"type": "expression_group",
|
|
1319
1351
|
"named": true
|
|
1320
1352
|
},
|
|
1353
|
+
{
|
|
1354
|
+
"type": "field_access",
|
|
1355
|
+
"named": true
|
|
1356
|
+
},
|
|
1321
1357
|
{
|
|
1322
1358
|
"type": "float",
|
|
1323
1359
|
"named": true
|
|
1324
1360
|
},
|
|
1361
|
+
{
|
|
1362
|
+
"type": "function_call",
|
|
1363
|
+
"named": true
|
|
1364
|
+
},
|
|
1325
1365
|
{
|
|
1326
1366
|
"type": "identifier",
|
|
1327
1367
|
"named": true
|
|
@@ -1442,10 +1482,18 @@
|
|
|
1442
1482
|
"type": "expression_group",
|
|
1443
1483
|
"named": true
|
|
1444
1484
|
},
|
|
1485
|
+
{
|
|
1486
|
+
"type": "field_access",
|
|
1487
|
+
"named": true
|
|
1488
|
+
},
|
|
1445
1489
|
{
|
|
1446
1490
|
"type": "float",
|
|
1447
1491
|
"named": true
|
|
1448
1492
|
},
|
|
1493
|
+
{
|
|
1494
|
+
"type": "function_call",
|
|
1495
|
+
"named": true
|
|
1496
|
+
},
|
|
1449
1497
|
{
|
|
1450
1498
|
"type": "identifier",
|
|
1451
1499
|
"named": true
|
|
@@ -1687,10 +1735,18 @@
|
|
|
1687
1735
|
"type": "expression_group",
|
|
1688
1736
|
"named": true
|
|
1689
1737
|
},
|
|
1738
|
+
{
|
|
1739
|
+
"type": "field_access",
|
|
1740
|
+
"named": true
|
|
1741
|
+
},
|
|
1690
1742
|
{
|
|
1691
1743
|
"type": "float",
|
|
1692
1744
|
"named": true
|
|
1693
1745
|
},
|
|
1746
|
+
{
|
|
1747
|
+
"type": "function_call",
|
|
1748
|
+
"named": true
|
|
1749
|
+
},
|
|
1694
1750
|
{
|
|
1695
1751
|
"type": "identifier",
|
|
1696
1752
|
"named": true
|
|
@@ -1822,10 +1878,18 @@
|
|
|
1822
1878
|
"type": "expression_group",
|
|
1823
1879
|
"named": true
|
|
1824
1880
|
},
|
|
1881
|
+
{
|
|
1882
|
+
"type": "field_access",
|
|
1883
|
+
"named": true
|
|
1884
|
+
},
|
|
1825
1885
|
{
|
|
1826
1886
|
"type": "float",
|
|
1827
1887
|
"named": true
|
|
1828
1888
|
},
|
|
1889
|
+
{
|
|
1890
|
+
"type": "function_call",
|
|
1891
|
+
"named": true
|
|
1892
|
+
},
|
|
1829
1893
|
{
|
|
1830
1894
|
"type": "identifier",
|
|
1831
1895
|
"named": true
|
|
@@ -1899,10 +1963,18 @@
|
|
|
1899
1963
|
"type": "expression_group",
|
|
1900
1964
|
"named": true
|
|
1901
1965
|
},
|
|
1966
|
+
{
|
|
1967
|
+
"type": "field_access",
|
|
1968
|
+
"named": true
|
|
1969
|
+
},
|
|
1902
1970
|
{
|
|
1903
1971
|
"type": "float",
|
|
1904
1972
|
"named": true
|
|
1905
1973
|
},
|
|
1974
|
+
{
|
|
1975
|
+
"type": "function_call",
|
|
1976
|
+
"named": true
|
|
1977
|
+
},
|
|
1906
1978
|
{
|
|
1907
1979
|
"type": "identifier",
|
|
1908
1980
|
"named": true
|
|
@@ -2100,10 +2172,18 @@
|
|
|
2100
2172
|
"type": "expression_group",
|
|
2101
2173
|
"named": true
|
|
2102
2174
|
},
|
|
2175
|
+
{
|
|
2176
|
+
"type": "field_access",
|
|
2177
|
+
"named": true
|
|
2178
|
+
},
|
|
2103
2179
|
{
|
|
2104
2180
|
"type": "float",
|
|
2105
2181
|
"named": true
|
|
2106
2182
|
},
|
|
2183
|
+
{
|
|
2184
|
+
"type": "function_call",
|
|
2185
|
+
"named": true
|
|
2186
|
+
},
|
|
2107
2187
|
{
|
|
2108
2188
|
"type": "identifier",
|
|
2109
2189
|
"named": true
|
|
@@ -2170,10 +2250,18 @@
|
|
|
2170
2250
|
"type": "expression_group",
|
|
2171
2251
|
"named": true
|
|
2172
2252
|
},
|
|
2253
|
+
{
|
|
2254
|
+
"type": "field_access",
|
|
2255
|
+
"named": true
|
|
2256
|
+
},
|
|
2173
2257
|
{
|
|
2174
2258
|
"type": "float",
|
|
2175
2259
|
"named": true
|
|
2176
2260
|
},
|
|
2261
|
+
{
|
|
2262
|
+
"type": "function_call",
|
|
2263
|
+
"named": true
|
|
2264
|
+
},
|
|
2177
2265
|
{
|
|
2178
2266
|
"type": "identifier",
|
|
2179
2267
|
"named": true
|
|
@@ -2547,10 +2635,18 @@
|
|
|
2547
2635
|
"type": "expression_group",
|
|
2548
2636
|
"named": true
|
|
2549
2637
|
},
|
|
2638
|
+
{
|
|
2639
|
+
"type": "field_access",
|
|
2640
|
+
"named": true
|
|
2641
|
+
},
|
|
2550
2642
|
{
|
|
2551
2643
|
"type": "float",
|
|
2552
2644
|
"named": true
|
|
2553
2645
|
},
|
|
2646
|
+
{
|
|
2647
|
+
"type": "function_call",
|
|
2648
|
+
"named": true
|
|
2649
|
+
},
|
|
2554
2650
|
{
|
|
2555
2651
|
"type": "identifier",
|
|
2556
2652
|
"named": true
|
|
@@ -2610,10 +2706,18 @@
|
|
|
2610
2706
|
"type": "expression_group",
|
|
2611
2707
|
"named": true
|
|
2612
2708
|
},
|
|
2709
|
+
{
|
|
2710
|
+
"type": "field_access",
|
|
2711
|
+
"named": true
|
|
2712
|
+
},
|
|
2613
2713
|
{
|
|
2614
2714
|
"type": "float",
|
|
2615
2715
|
"named": true
|
|
2616
2716
|
},
|
|
2717
|
+
{
|
|
2718
|
+
"type": "function_call",
|
|
2719
|
+
"named": true
|
|
2720
|
+
},
|
|
2617
2721
|
{
|
|
2618
2722
|
"type": "identifier",
|
|
2619
2723
|
"named": true
|
test/corpus/functions.txt
CHANGED
|
@@ -40,15 +40,32 @@ pub fn add(a: Int, b: Int) -> Int {
|
|
|
40
40
|
(let
|
|
41
41
|
(identifier)
|
|
42
42
|
(float))
|
|
43
|
+
(function_call
|
|
44
|
+
(field_access
|
|
43
|
-
|
|
45
|
+
(identifier)
|
|
46
|
+
(label))
|
|
47
|
+
(arguments))
|
|
44
|
-
(
|
|
48
|
+
(when
|
|
49
|
+
(identifier)
|
|
45
|
-
(
|
|
50
|
+
(when_entry
|
|
46
|
-
|
|
51
|
+
(integer)
|
|
47
|
-
|
|
52
|
+
(string
|
|
48
|
-
(quoted_content)
|
|
49
|
-
(quoted_content)
|
|
50
|
-
|
|
53
|
+
(quoted_content)))
|
|
54
|
+
(when_entry
|
|
55
|
+
(string
|
|
56
|
+
(quoted_content))))
|
|
57
|
+
(if
|
|
58
|
+
(binary_expression
|
|
59
|
+
(identifier)
|
|
60
|
+
(identifier))
|
|
61
|
+
(function_call
|
|
62
|
+
(field_access
|
|
63
|
+
(identifier)
|
|
51
|
-
|
|
64
|
+
(label))
|
|
65
|
+
(arguments
|
|
66
|
+
(argument
|
|
67
|
+
(string
|
|
68
|
+
(quoted_content)))))))
|
|
52
69
|
(function
|
|
53
70
|
(visibility_modifier)
|
|
54
71
|
(identifier)
|