Skip to content

Commit 74bbb70

Browse files
committed
Add V lang
1 parent 0e18bfa commit 74bbb70

File tree

9 files changed

+84
-4
lines changed

9 files changed

+84
-4
lines changed

db/a-schema.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ CREATE TYPE lang AS ENUM (
2222
'bash', 'brainfuck', 'c', 'c-sharp', 'cobol', 'f-sharp', 'fish',
2323
'fortran', 'go', 'haskell', 'j', 'java', 'javascript', 'julia', 'lisp',
2424
'lua', 'nim', 'perl', 'php', 'powershell', 'python', 'raku', 'ruby',
25-
'rust', 'sql', 'swift', 'zig'
25+
'rust', 'sql', 'swift', 'v', 'zig'
2626
);
2727

2828
CREATE TYPE scoring AS ENUM ('bytes', 'chars');

docker/dev.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ COPY --from=codegolf/lang-powershell ["/", "/langs/powershell/rootfs/"] # 185 M
1616
COPY --from=codegolf/lang-c-sharp ["/", "/langs/c-sharp/rootfs/" ] # 128 MiB
1717
COPY --from=codegolf/lang-go ["/", "/langs/go/rootfs/" ] # 110 MiB
1818
COPY --from=codegolf/lang-f-sharp ["/", "/langs/f-sharp/rootfs/" ] # 108 MiB
19+
COPY --from=codegolf/lang-v ["/", "/langs/v/rootfs/" ] # 97.1 MiB
1920
COPY --from=codegolf/lang-java ["/", "/langs/java/rootfs/" ] # 68.7 MiB
2021
COPY --from=codegolf/lang-raku ["/", "/langs/raku/rootfs/" ] # 50.6 MiB
2122
COPY --from=codegolf/lang-lisp ["/", "/langs/lisp/rootfs/" ] # 35.4 MiB

docker/live.Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ COPY --from=codegolf/lang-powershell ["/", "/langs/powershell/rootfs/"] # 185 M
2626
COPY --from=codegolf/lang-c-sharp ["/", "/langs/c-sharp/rootfs/" ] # 128 MiB
2727
COPY --from=codegolf/lang-go ["/", "/langs/go/rootfs/" ] # 110 MiB
2828
COPY --from=codegolf/lang-f-sharp ["/", "/langs/f-sharp/rootfs/" ] # 108 MiB
29+
COPY --from=codegolf/lang-v ["/", "/langs/v/rootfs/" ] # 97.1 MiB
2930
COPY --from=codegolf/lang-java ["/", "/langs/java/rootfs/" ] # 68.7 MiB
3031
COPY --from=codegolf/lang-raku ["/", "/langs/raku/rootfs/" ] # 50.6 MiB
3132
COPY --from=codegolf/lang-lisp ["/", "/langs/lisp/rootfs/" ] # 35.4 MiB

langs.toml

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,8 @@ example = '''
410410
print("Hello, World!")
411411
412412
// Looping
413-
for n in 0...9 {
414-
print(n)
413+
for i in 0...9 {
414+
print(i)
415415
}
416416
417417
// Accessing arguments
@@ -420,6 +420,27 @@ for arg in CommandLine.arguments[1...] {
420420
}
421421
'''
422422

423+
[V]
424+
size = '97.1 MiB'
425+
version = '0.2'
426+
website = '//vlang.io'
427+
example = '''
428+
import os
429+
430+
// Printing
431+
println('Hello, World!')
432+
433+
// Looping
434+
for i in 0..10 {
435+
println(i)
436+
}
437+
438+
// Accessing arguments
439+
for arg in os.args[1..] {
440+
println(arg)
441+
}
442+
'''
443+
423444
[Zig]
424445
size = '216 MiB'
425446
version = '0.7.0'

langs/v/Dockerfile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
FROM debian:buster-slim as builder
2+
3+
RUN mkdir /empty
4+
5+
RUN apt-get update && apt-get install -y gcc git make
6+
7+
RUN git clone -b 0.2 git://github.com/vlang/v /opt/v
8+
9+
RUN cd /opt/v && make
10+
11+
FROM debian:buster-slim
12+
13+
RUN apt-get update && apt-get install -y libc-dev
14+
15+
COPY --from=0 /opt/v/thirdparty/tcc /opt/v/thirdparty/tcc
16+
COPY --from=0 /opt/v/v /opt/v/v
17+
COPY --from=0 /opt/v/vlib /opt/v/vlib
18+
19+
FROM scratch
20+
21+
COPY --from=1 /bin /bin
22+
COPY --from=1 /lib /lib
23+
COPY --from=1 /lib64 /lib64
24+
COPY --from=1 /opt/v /opt/v
25+
COPY --from=0 /empty /proc
26+
COPY --from=0 /empty /tmp
27+
COPY --from=1 /usr /usr
28+
29+
COPY v /usr/bin/
30+
31+
CMD ["/opt/v/v", "version"]

langs/v/v

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/sh -e
2+
3+
# FIXME Setting VVV=/opt/v doesn't prevent the need to cd.
4+
cd /opt/v
5+
6+
# FIXME "v run -" writes the code to the cwd first, which fails under r/o.
7+
# V panic: Failed to create temporary file 01ETADWV0J7NFKFRH587599FQQ.v
8+
9+
# Compile
10+
cat - > /tmp/code.v
11+
./v /tmp/code.v
12+
rm /tmp/code.v
13+
14+
# Execute
15+
shift
16+
exec /tmp/code "$@"

t/args.t

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,14 @@ swift
162162
print(a)
163163
}
164164
165+
v
166+
167+
import os
168+
169+
for a in os.args[1..] {
170+
println(a)
171+
}
172+
165173
zig
166174
167175
const std = @import("std");

views/css/golfer/holes.css

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ input.ruby:not(:checked) ~ .ruby,
5959
input.rust:not(:checked) ~ .rust,
6060
input.sql:not(:checked) ~ .sql,
6161
input.swift:not(:checked) ~ .swift,
62+
input.v:not(:checked) ~ .v,
6263
input.zig:not(:checked) ~ .zig { display: none }
6364

6465
input:checked + label {
@@ -84,7 +85,7 @@ main svg:nth-of-type(2) {
8485

8586
@media (min-width: 1280px) {
8687
/* Increase this number when adding a language. */
87-
main { grid-template-columns: 4fr repeat(27, 1fr) }
88+
main { grid-template-columns: 4fr repeat(28, 1fr) }
8889

8990
main a { height: 1.9rem }
9091

views/svg/v.svg

Lines changed: 1 addition & 0 deletions
Loading

0 commit comments

Comments
 (0)