forked from code-golf/code-golf
-
Notifications
You must be signed in to change notification settings - Fork 0
/
langs.toml
699 lines (581 loc) · 10.8 KB
/
langs.toml
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
['><>']
size = '477 KiB'
version = 'b71dce3'
website = 'https://github.com/primo-ppcg/fish-jit'
example = '''
\ printing
> "!dlroW ,olleH" ooooooooooooo ao 03.
looping
> 0 v
>:nao 1+ :9)?v
v ~<
accessing arguments
> i : ?!v : 0) ?v ~;
a
o o
~
^ < <
'''
[Assembly]
size = '48.7 MiB'
version = 'DefAssembler 1.6.0'
website = 'https://www.npmjs.com/package/@defasm/core'
example = '''
# Printing
mov $1, %eax # Syscall code 1 (write)
mov $1, %edi # File descriptor 1 (stdout)
mov $text, %rsi # Address of buffer
mov $14, %edx # Length of buffer
syscall
# Looping
mov $10, %bl
numberLoop:
mov $1, %eax
mov $1, %edi
mov $digit, %rsi
mov $2, %edx
syscall
incb (%rsi)
dec %bl
jnz numberLoop
# Accessing arguments
pop %rbx
pop %rax
argLoop:
dec %rbx
jz endArgLoop
pop %rsi
mov %rsi, %rdi
mov $-1, %ecx
xor %al, %al
repnz scasb
not %ecx
movb $'\n', -1(%rsi, %rcx)
mov %ecx, %edx
mov $1, %eax
mov $1, %edi
syscall
jmp argLoop
endArgLoop:
mov $60, %eax # Syscall code 60 (exit)
mov $0, %edi # Exit code
syscall
text: .string "Hello, World!\n"
digit: .byte '0', '\n'
'''
[Bash]
size = '1.14 MiB'
version = '5.1.8'
website = 'https://www.gnu.org/software/bash/'
example = '''
# Printing
echo Hello, World!
# Looping
for i in {0..9}; do
echo $i;
done
# Accessing arguments
for arg; do
echo $arg;
done
'''
[brainfuck]
size = '4.56 MiB'
version = 'c68db6c'
website = 'https://github.com/primo-ppcg/bf-jit'
example = '''
>>Printing
+[-->-[>>+>-----<<]<--<---]>-.>>>+.>>..+++[.>]<<<<.+++.------.<<-.>>>>+.[<->-]<-.>
>>Looping
++++++++[>++++++<-]
++++++++++[>.+>++++++++++.[-]<<-]
>>Accessing arguments
,[
[
.[-],
]
++++++++++.
[-],
]
'''
[C]
size = '1.61 MiB'
version = 'Tiny C Compiler 0.9.27'
website = 'https://bellard.org/tcc/'
example = '''
#include <stdio.h>
int main(int argc, char* argv[]) {
// Printing
puts("Hello, World!");
// Looping
for (int i = 0; i < 10; i++)
printf("%d\n", i);
// Accessing arguments
for (int i = 1; i < argc; i++)
puts(argv[i]);
return 0;
}
'''
['C#']
size = '130 MiB'
version = 'C# 9.0 on .NET 5.0.7'
website = 'https://docs.microsoft.com/dotnet/csharp/'
example = '''
using System;
// Printing
Console.WriteLine("Hello, World!");
// Looping
for (int i = 0; i < 10; i++)
Console.WriteLine(i);
// Accessing arguments
foreach (String arg in args)
Console.WriteLine(arg);
'''
[COBOL]
size = '4.1 MiB'
version = 'GnuCOBOL 3.1.2.0'
website = 'https://gnucobol.sourceforge.io'
example = '''
program-id.example.
data division.
local-storage section.
1 n pic 99 value 0.
1 i pic 99.
1 a pic X(99).
procedure division.
*> Printing
display "Hello, World!"
*> Looping
perform 10 times
display n(2- function log10(n):)
add 1 to n
end-perform.
*> Accessing arguments
accept i from argument-number
perform i times
accept a from argument-value
display a
end-perform.
end-program.
'''
[Crystal]
size = '284 MiB'
version = '1.0.0'
website = 'https://crystal-lang.org'
example = '''
# Printing
puts "Hello, World!"
# Looping
(0..9).each do |i|
puts i
end
# Accessing arguments
ARGV.each do |arg|
puts arg
end
'''
['F#']
size = '119 MiB'
version = 'F# 5.0 on .NET 5.0.7'
website = 'https://fsharp.org'
example = '''
[<EntryPoint>]
let main args =
// Printing
printfn "Hello, World!"
// Looping
for i in 0..9 do
printfn "%d" i
// Accessing arguments
for arg in args do
printfn "%s" arg
0
'''
[Fortran]
size = '80.6 MiB'
version = 'GNU Fortran 11.1.0'
website = 'https://gcc.gnu.org/fortran/'
example = '''
character(len=32) :: s
integer :: i
! Printing
print "(a)", "Hello, World!"
! Looping
do i = 0, 9
print "(i0)", i
end do
! Accessing arguments
! (NOTE: getarg() and iargc() are GNU Fortran extensions)
do i = 1, iargc()
call getarg(i,s)
print "(a)", s
end do
end
'''
[Go]
size = '124 MiB'
version = '1.16.5'
website = 'https://go.dev'
example = '''
package main
import (
"fmt"
"os"
)
func main() {
// Printing
fmt.Println("Hello, World!")
// Looping
for i := 0; i < 10; i++ {
fmt.Println(i)
}
// Accessing arguments
for _, arg := range os.Args[1:] {
fmt.Println(arg)
}
}
'''
[Haskell]
size = '332 MiB'
version = 'Glasgow Haskell Compiler 8.8.4'
website = 'https://www.haskell.org/ghc/'
example = '''
import System.Environment
main = do
-- Printing
putStrLn "Hello, World!"
-- Looping
mapM print [0..9]
-- Accessing arguments
args <- tail <$> getArgs
mapM putStrLn args
'''
[Hexagony]
size = '62.6 MiB'
version = '4b30f58'
website = 'https://github.com/SirBogman/Hexagony'
example = '''
\ P r i n t i n g .
\ H ; e ; l ; ; o ; \
/ o ; W ; 0 P ; 2 Q < .
. > ; r ; l ; d ; P 1 ; \
> * . . . . . . . . . . < .
. . . . . . . . . . . . . . .
. . L o o p i n g . . . . . . .
\ 1 0 ; " $ / } ! ) " ; \ . . . .
. . . . . . . > . - " = < . . . . .
. / . . . . . < . . . . . . . . . . .
. . . . . . . . . . . . . . . . . .
. . . A c c e s s i n g . . . . .
. . . A r g u m e n t s . . . .
. . . . . . > \ . @ . . . . .
. > $ > , < \ ) < . . . . .
. . \ . ; / $ 0 / . . . .
. . . . . . . . . . . .
. . . . . . . . . . .
. . . . . . . . . .
'''
[J]
size = '4.77 MiB'
version = '9.02.08'
website = 'https://www.jsoftware.com'
example = '''
NB.Printing
echo'Hello, World!'
NB.Looping
echo i.10 1
NB.Accessing arguments
echo each 2}.ARGV
'''
[Java]
size = '69.2 MiB'
version = '16.0.1'
website = 'https://openjdk.java.net'
example = '''
class Main {
public static void main(String[] args) {
// Printing
System.out.println("Hello, World!");
// Looping
for (int i = 0; i < 10; i++)
System.out.println(i);
// Accessing arguments
for (String arg : args)
System.out.println(arg);
}
}
'''
[JavaScript]
size = '20.8 MiB'
version = 'V8 9.1.269.36'
website = 'https://v8.dev'
example = '''
// Printing
print("Hello, World!");
// Looping
for (let i = 0; i < 10; i++)
print(i);
// Accessing arguments
for (let arg of arguments)
print(arg);
'''
[Julia]
size = '287 MiB'
version = '1.6.1'
website = 'https://julialang.org'
example = '''
# Printing
println("Hello, World!")
# Looping
for i=0:9
println(i)
end
# Accessing arguments
for arg in ARGS
println(arg)
end
'''
[Lisp]
size = '33.6 MiB'
version = 'GNU CLISP 2.49.92'
website = 'https://clisp.sourceforge.io'
example = '''
; Printing
(write-line "Hello, World!")
; Looping
(loop for i from 0 to 9
do (format t "~d~%" i)
)
; Accessing Arguments
(loop for arg in *args*
do (write-line arg)
)
'''
[Lua]
size = '338 KiB'
version = '5.4.3'
website = 'https://www.lua.org'
example = '''
-- Printing
print("Hello, World!")
-- Looping
for i = 0, 9 do
print(i)
end
-- Accessing arguments
for i = 1, #arg do
print(arg[i])
end
'''
[Nim]
size = '21.6 MiB'
version = '1.4.8'
website = 'https://nim-lang.org'
example = '''
import os
# Printing
echo "Hello, World!"
# Looping
for i in 0 .. 9:
echo i
# Accessing arguments
for arg in commandLineParams():
echo arg
'''
[Pascal]
size = '31.3 MiB'
version = '3.2.2'
website = 'https://freepascal.org'
example = '''
var
i: integer;
begin
{ Printing }
writeLn('Hello, World!');
{ Looping }
for i := 0 to 9 do
writeLn(i);
{ Accessing arguments }
for i := 1 to paramCount() do
writeLn(paramStr(i));
end.
'''
[Perl]
size = '4.32 MiB'
version = '5.34.0'
website = 'https://www.perl.org'
example = '''
# Printing
say 'Hello, World!';
# Looping
say for 0..9;
# Accessing arguments
say for @ARGV;
'''
[PHP]
size = '10.5 MiB'
version = '7.4.21'
website = 'https://www.php.net'
example = '''
# Printing
echo "Hello, World!\n";
# Looping
for ($i = 0; $i < 10; $i++)
echo "$i\n";
# Accessing arguments
while ($arg = next($argv))
echo "$arg\n";
'''
[PowerShell]
size = '185 MiB'
version = 'PowerShell 7.1.3 on .NET 5.0.7'
website = 'https://docs.microsoft.com/powershell/scripting/overview'
example = '''
# Printing
Write-Host 'Hello, World!'
# Looping
ForEach ($i in 0..9) {
Write-Host $i
}
# Accessing arguments
ForEach ($arg in $args) {
Write-Host $arg
}
'''
[Python]
size = '57 MiB'
version = '3.9.6'
website = 'https://www.python.org'
example = '''
import sys
# Printing
print('Hello, World!')
# Looping
for i in range(10):
print(i)
# Accessing arguments
for arg in sys.argv[1:]:
print(arg)
'''
[Raku]
size = '54 MiB'
version = 'Raku 6.d on Rakudo 2021.06'
website = 'https://raku.org'
example = '''
# Printing
say 'Hello, World!';
# Looping
.say for ^10;
# Accessing arguments
.say for @*ARGS;
'''
[Ruby]
size = '14.4 MiB'
version = '3.0.1'
website = 'https://www.ruby-lang.org'
example = '''
# Printing
puts 'Hello, World!'
# Looping
(0..9).each do |i|
puts i
end
# Accessing arguments
ARGV.each do |arg|
puts arg
end
'''
[Rust]
size = '661 MiB'
version = '1.53.0'
website = 'https://www.rust-lang.org'
example = '''
fn main() {
// Printing
println!("Hello, World!");
// Looping
for i in 0..10 {
println!("{}", i);
}
// Accessing arguments
for arg in std::env::args().skip(1) {
println!("{}", arg);
}
}
'''
[SQL]
size = '1.03 MiB'
version = '3.36.0'
website = 'https://sqlite.org/index.html'
example = '''
-- Printing
SELECT 'Hello, World!'
UNION ALL
SELECT * FROM (
-- Looping
WITH loop(i) AS (
SELECT 0
UNION ALL
SELECT i+1 FROM loop
WHERE i<9
)
SELECT i FROM loop
)
UNION ALL
-- Accessing arguments
SELECT arg FROM argv
'''
[Swift]
size = '693 MiB'
version = '5.3.3'
website = 'https://swift.org'
example = '''
// Printing
print("Hello, World!")
// Looping
for i in 0...9 {
print(i)
}
// Accessing arguments
for arg in CommandLine.arguments[1...] {
print(arg)
}
'''
[V]
size = '102 MiB'
version = '0.2.2'
website = 'https://vlang.io'
example = '''
import os
// Printing
println('Hello, World!')
// Looping
for i in 0..10 {
println(i)
}
// Accessing arguments
for arg in os.args[1..] {
println(arg)
}
'''
[Zig]
size = '241 MiB'
version = '0.8.0'
website = 'https://ziglang.org'
example = '''
const std = @import("std");
pub fn main() !void {
const stdout = std.io.getStdOut().writer();
// Printing
try stdout.print("Hello, World!\n", .{});
// Looping
var i: i32 = 0;
while (i < 10) : (i += 1)
try stdout.print("{}\n", .{i});
// Accessing arguments
var args = std.process.args();
_ = args.skip();
while (args.next(std.testing.allocator)) |arg|
try stdout.print("{s}\n", .{arg});
}
'''