-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
speedie.scroll
372 lines (356 loc) · 7.87 KB
/
speedie.scroll
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
55
56
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
110
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
165
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
import ../code/conceptPage.scroll
id speedie
name Speedie
appeared 2022
creators Theodore H Smith
tags pl
website http://github.com/gamblevore/speedie
webRepl http://github.com/gamblevore/speedie
conceptDescription "General-purpose modern and clean object-oriented programming language."
writtenIn speedie cpp
supersetOf jeebox
relatedConcepts i-expressions json yaml toml xml haml ini grammar treenotation
influencedBy javascript python c lua cpp visual-basic hypercard html css xml json
gdbSupport false
fileExtensions spd scproj
visualParadigm false
fileType text
documentation https://github.com/gamblevore/speedie/blob/main/Documentation
emailList https://t.me/speedie_dev
country United Kingdom
originCommunity https://github.com/gamblevore/speedie/issues
helloWorldCollection spd
main
"Hello World!"
twitter https://twitter.com/gamblevore
keywords #require #expect #error and asm break class continue else elseif false for if is in import module or return require expect error virtual behaviour function syntax syx self true with yield while xor
lineCommentToken //
multiLineCommentTokens /* */
printToken print
assignmentToken =
booleanTokens true false
hasPartialApplication true
main
"hello world ${app.args[0]}"
hasMultipleDispatch false
hasMaps true
|| x = ["a":"Apple", "b":"Bird", "c":"Cat"]
printline x["b"] // Bird
hasPipes true
hasManualMemoryManagement false
hasPolymorphism true
|object| x = somefunction()
|| y = x.render // returns a string by calling the virtual func "render"
hasAssertStatements true
class Person
|int| age
setter age
// "expect" will actually add an Error to a list of errors
expect (value >= 0) ("bad age $value set!")
.age = value
main
|| p = person()
p.age = -10
if !stderr.ok
"Oof we got some errors"
hasDocComments true
function Find (|string| pattern, |int| pos=0, |int|)
description "Returns the position of pattern in self, starting from 'pos'. If not found, we return -1."
hasUnicodeIdentifiers true
class é©©
constructor
printline .class.name // "é©©"
hasDefaultParameters true
function Find (|string| pattern, |int| pos=0, |int|)
hasMagicGettersAndSetters true
hasMacros true
hasTypeInference true
|| x = "Hello"
|| y = FunctionThatReturnsAString() // is now a string
x = 1 // fails to compile
y = 2 // fails to compile
hasStaticTyping true
|| x = "Hello"
x = 1 // fails to compile... because x is a string
hasIncrementAndDecrementOperators true
|| x = 1
x++
x--
hasSingleDispatch true
|| x = "str"
|| i = x.find("t")
hasModules true
module App
function Path (|string|)
// return the app's path here
hasExplicitTypeCasting true
|| x = message()
|| y = x|object| // lose type info
|| z = y|message| // regain it
hasStructs true
struct Fuel
|int| A
|byte| B
hasEnums true
flags
A
B
C
D
// A=1, B=2, C=4, D=8
constants
X
Y
Z
W
// X=0, Y=1, Z=3, W=4
canWriteToDisk true
"helloworld.txt" <~ "Hello, world!\n"
hasDuckTyping false
hasRegularExpressionsSyntaxSugar false
isCaseSensitive true
|| Same = "x" == "X" // same = false
hasCaseInsensitiveIdentifiers true
if "abc".LeNgTh == 3
"cool length"
hasTernaryOperators true
while
printline (1,0)(random[]>0.5)
hasMessagePassing true
|| chld = app.fork("ipc_identifier_123", app.rawargs)
chld <~ "send message"
printline chld.get // receive message
hasBitWiseOperators true
x << y
canDoShebang true
#!/usr/local/bin/spd
hasSymbolTables true
hasDynamicProperties false
hasBooleans true
hasConditionals true
hasContinue true
for i in 10
if i < 5: continue
printline i // 6,7,8,9
hasBreak true
for i in 10
if i > 3: exit
printline i // 1,2,3
hasConstants true
constants
Opened = 1
Closed = 2
hasGarbageCollection true
|| msg = message()
DoSomethingWith(msg)
// msg now gets disposed
hasComments true
// comment
hasMultiLineComments true
/*
multiline
comments
*/
hasImports true
import Proj
hasAssignment true
name = "John"
hasWhileLoops true
while true
"hello"
hasForLoops true
while i in 10
"hello: $i"
hasEscapeCharacters true
|| str = "\01\02\03"
hasCharacters true
|| char = 'b'
if b > 32
"good"
hasStringConcatOperator true
|| ab = "a" + "b"
hasMemberVariables true
class abc
|int| def
hasTryCatch false
|| data = "somefile".file.readall
if !data
stderr.printerrors // prints any file-system error that occurred during .readall
hasStatementTerminatorCharacter true
if x: x++, x*=2, return
hasSelfOrThisWord true
self.Remove
.remove
hasRequiredMainFunction true
main
"hello world"
hasDynamicSizedArrays true
|| arr = []
arr <~ "abc"
canReadCommandLineArgs true
printline app[0]
hasFnArguments true
function ABC (|string| name)
hasGlobalScope true
|| x = 123
function abc
x = 10
hasVoidFunctions true
|| x = 123
function abc
x = 10
hasMethodOverloading true
hasTimestamps true
printline __time_id__
hasTypeParameters true
function ABC (|string| name)
hasStaticMethods true
class abc
module
function Print
"abc"
main
abc.print
hasVirtualFunctions true
class abc
virtual DoSomething (|string| name)
behaviour DoSomething
printline "hello: $name"
hasSourceMaps true
linkage
bannedclasses (file, process, shellstream, archive)
// using these classes... even indirectly, will create an error
// the error message will show the entire call-chain that reached these classes
supportsBreakpoints true
debugger
hasInfixNotation true
seven = 3 + 4
hasMultilineStrings true
"hello
you
beauty"
hasHomoiconicity true
The~entire~Language is (%written in:@Jeebox)
hasPointers true
|| i = 0
|| p = &i
*p = 1
if (i == 1)
"success"
hasIntegers true
pldb = 80766866
hasUnitsOfMeasure true
|| time = 1day - 10s
|| size = 10.2MB
hasLists true
myList = [1, 2, 3, 4, 5]
hasFunctions true
function Example (|string| data)
file <~ data
hasOctals false
hasHexadecimals true
|| num = 0xBEEF
hasFloats true
|| num = 0.0
hasBinaryNumbers true
|| num = 0b010101
hasConstructors true
class Foobar
|float| x
|float| y
constructor (|float| r=1, |float| alpha=0)
.x = r * alpha.cos
.y = r * alpha.sin
|| a = foobar()
|| b = foobar(3)
|| c = foobar(5, M_PI/4)
hasIterators true
|| items = [5,6,7,8]
for i in items
printline i
hasForEachLoops true
|| items = [5,6,7,8]
for i in items
printline i
hasSingleTypeArrays true
|array of string| s
s <~ "abc" // ok
s <~ 1 // fail
hasReservedWords false
|| return = 123
|| if = 456
if if == 456
return return
hasFunctionOverloading true
function volume (|float| a, |float|)
return a*a*a
function volume (|float| r, |float| h, |float|)
// volume of a cylinder
return math.pi*r*r*h
hasNamespaces false
hasMultipleInheritance false
hasOperatorOverloading true
str = "a" + "b"
array <~ str
hasUserDefinedOperators true
class myclass
|int| Num
operator add (|int| x, |myclass|)
return myclass(.num + x)
render
fs <~ .num
main
|| x = myclass(1)
|| y = myclass(2)
|| z = y + x
printline z
hasUnaryOperators true
|| x = !0
hasNull true
|| msg = message()
while
if msg != nil
"msg exists"
else
"empty"
return
msg = nil
hasSemanticIndentation true
class Person
|string| name
hasInheritance true
class Person (Animal)
hasAccessModifiers true
class Person
|int| age
setter age
expect (value >= 0) ("bad age $value set!")
.age = value
main
|| p = person()
p.age = -1 // calls a function rather than the property
|| n = p.age // reads the property directly!
hasStrings true
"hello world"
hasDisposeBlocks true
using SomeObject
for 10
Someobject.dosomework
if (random[]>0.5)
return // someobject.SyntaxUsingComplete called here
// someobject.SyntaxUsingComplete called here too
hasPrintDebugging true
"error 1 here"
hasZeroBasedNumbering true
printline ["a", "b", "c"][0] // prints "a"
hasTemplates false
hasThreads false
hasClasses true
hasExceptions false
pypl spd
domainName speedie.dev
registered 2023
githubLanguage Speedie
fileExtensions spd scproj
type programming
tmScope source.spd