-
-
Notifications
You must be signed in to change notification settings - Fork 84
/
jule.scroll
371 lines (350 loc) · 6.7 KB
/
jule.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
import ../code/conceptPage.scroll
id jule
name Jule
appeared 2021
creators Mertcan Davulcu
tags pl
website https://jule.dev
conceptDescription Jule is the simple, efficient, statically typed and compiled system programming language.
isOpenSource true
writtenIn yaml markdown bourne-shell dockerfile
influencedBy c cpp rust go
fileExtensions .jule
visualParadigm false
fileType text
documentation https://jule.dev/pages/manual.html?page=jule-lang
centralPackageRepositoryCount 0
repoStats
firstCommit 2021
commits 3944
committers 13
files 362
newestCommit 2024
country Turkey
originCommunity https://github.com/julelang
example
fn quicksort(mut s: []int) {
if s.len <= 1 {
ret
}
let mut i = -1
let last = s[s.len-1]
for j in s {
let mut x = &s[j]
if (unsafe{ *x <= last }) {
i++
let mut y = &s[i]
unsafe { *x, *y = *y, *x }
}
}
quicksort(s[:i])
quicksort(s[i+1:])
}
fn main() {
let mut my_slice = [1, 9, -2, 25, -24, 4623, 0, -1, 0xFD2]
outln(my_slice)
quicksort(my_slice)
outln(my_slice)
}
example
fn main() {
outln("Hello World")
}
example
use std::math::{PI}
trait Shape {
fn area(self): f32
}
struct Rectangle {
width: int
height: int
}
impl Shape for Rectangle {
fn area(self): f32 {
ret self.width * self.height
}
}
struct Circle {
r: f32
}
impl Shape for Circle {
fn area(self): f32 {
ret PI * self.r * self.r
}
}
fn main() {
let rect: Shape = Rectangle{90, 5}
let circ: Shape = Circle{90.5}
outln(rect.area())
outln(circ.area())
}
keywords fn pub struct enum unsafe const let mut self match if else for in impl trait break continue goto cpp i8 i16 i32 i64 u8 u16 u32 u64 f32 f64 str int uint type any true false bool ret fall nil uintptr co
githubRepo https://github.com/julelang/jule
firstCommit 2021
stars 67
forks 9
subscribers 5
created 2021
updated 2022
description Jule is the simple, efficient, statically typed and compiled system programming language.
issues 12
lineCommentToken //
multiLineCommentTokens /* */
printToken outln
assignmentToken =
stringToken "
booleanTokens true false
includeToken use
hasStrings true
"Jule String Literal"
`Jule Raw String Literal`
hasLineComments true
// A comment
hasComments true
// A comment
/* A comment */
hasMultiLineComments true
/*
A multi line comment
*/
hasPrintDebugging true
hasSemanticIndentation false
hasPointers true
let ptr: *int = nil
hasFunctions true
fn a_function() {
// ...
}
hasFunctionOverloading false
hasMethods true
impl MyStruct {
fn my_method(self) {}
}
hasMethodOverloading false
hasMaps true
let my_map: [int:str] = {
0: "Key 0",
1: "Key 1",
2: "Key 2",
}
hasTraits true
trait Person {
fn get_full_name(self): str
fn get_age(self): byte
}
hasGenerics true
fn generic_function[T](s: []T) {
// ...
}
hasBooleans true
true false
hasConstants true
const PI = 3.14159265359
hasGarbageCollection false
hasNull true
nil
hasAnonymousFunctions true
let anonymous = fn() {
outln("Anonymous Function")
}
anonymous()
hasBreak true
break
break a_label
hasContinue true
continue
continue a_label
hasEnums true
enum ExitCode {
Success = 0,
Failure = 1
}
hasFloats true
3.14
32.60
032.60
3.
0.3
1E2
.12345E+6
1.e+0
0x1p-2
0x2.p10
0x1.Fp+0
0X.8p-0
0x1fffp-16
0x15e-2
hasIntegers true
12345
0b0001010101
0455
0xDFF90
hasStructs true
struct Employee {
first_name: str
last_name: str
salary: f32
}
hasHexadecimals true
0xDFF90
hasOctals true
0455
hasDecimals true
12345
hasBinaryNumbers true
0b0001010101
hasVoidFunctions true
fn a_void_function() {
// ...
}
hasScientificNotation true
1E2
.12345E+6
1.e+0
0x15e-2
0x2.p10
0X.8p-0
0x1.Fp+0
0x1fffp-16
0x1p-2
hasPolymorphism false
hasGlobalScope true
hasValueReturnedFunctions true
fn get_pi(): f64 {
ret 3.14159265359
}
hasDirectives true
hasBitWiseOperators true
& | ^ << >>
hasOperatorOverloading false
hasUserDefinedOperators false
hasAssertStatements true
use std::debug
use std::debug::assert::{assert}
fn main() {
std::debug::ENABLE = true
let x = 200
assert(x < 200)
}
hasVariadicFunctions true
fn average(x: ...f64): f64 {
// ...
}
hasUnaryOperators true
* & - + ^ !
hasDependentTypes true
int uint uintptr
hasFnArguments true
isCaseSensitive true
canReadCommandLineArgs true
use std::os::{ARGS}
fn main() {
outln(ARGS)
}
hasForEachLoops true
for x, y in my_enumerable {
// ...
}
hasForLoops true
// Jule has for loops with while-next iterations
let mut i = 0
for i < 10; i++ {
// ...
}
hasWhileLoops true
for my_condition {
// ...
}
hasDocComments true
// Documentation comment for a_function
fn a_function() {}
hasIfs true
hasIfElses true
hasDynamicSizedArrays true
let mut a_slice = [1, 2, 3, 4, 5, 6]
a_slice = append(a_slice, 7, 8, 9, 10)
hasLabels true
a_label:
hasGotos true
goto a_label
hasRequiredMainFunction true
fn main() {}
hasSelfOrThisWord true
self
hasBoundedCheckedArrays true
let arr: [5]byte = ['a', 'b', 'c', 'd', 'e']
hasTernaryOperators false
hasStatementTerminatorCharacter true
;
hasStatements true
canUseQuestionMarksAsPartOfIdentifier false
hasThreads true
fn my_thread() {
outln("Hello from thread")
}
fn main() {
co my_thread()
}
hasAssignment true
let mut x = 0
x = 20
hasTypeAnnotations true
let x: f64 = 89
hasAccessModifiers true
pub
hasAsyncAwait false
hasTryCatch false
hasMemberVariables true
hasRegularExpressionsSyntaxSugar false
hasReservedWords true
hasSwitch true
match X {
| Y: outln("X is Y")
| Z: outln("X is Z")
| A | B | C: outln("X is A, B, or C")
|: outln("X is not Y, Z, A, B and C")
}
hasDuckTyping true
fn lock_object[T](obj: T) {
obj.lock()
}
isLisp false
hasArraySlicingSyntax true
sliceable_expression[start_index:to_index]
hasExplicitTypeCasting true
let x = (int)(3.14)
hasManualMemoryManagement true
use std::mem::c::{malloc, free}
fn main() {
let mut ptr = malloc(8)
free(ptr)
ptr = nil
}
hasConditionals true
if BOOLEAN_EXPRESSION {
outln(""Condition is true)
}
hasIncrementAndDecrementOperators true
++
--
hasStaticTyping true
canWriteToDisk true
use std::fs::{open, O_WRONLY}
fn main() {
let (mut f, _) = open("myfile.txt", O_WRONLY, 0)
let bytes = ([]byte)("Text to write")
f.write(bytes)
f.close()
}
hasStringConcatOperator true
+
hasMultilineStrings true
`Multiline strings
is available in Jule
with raw strings`
hasImports true
use std::fs
use std::sys::{self, open, O_RDWR}
use std::math::*
domainName jule.dev
registered 2022