-
Notifications
You must be signed in to change notification settings - Fork 0
/
languages.yaml
263 lines (239 loc) · 8.51 KB
/
languages.yaml
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
# Language configuration for Kattis Problem Format
# ================================================
#
# The language configuration consists of a dictionary of languages.
# The keys in the dictionary are lower-case alphanumeric identifiers
# (must match the regular expression "[a-z][a-z0-9]*"). Each language
# is in turn a dictionary which may contain the following six keys.
#
# name: String, name of the language.
#
# priority: Integer indicating the tie-breaker priority of this
# language for language detection. See "language detection"
# below. All languages must have distinct priorities.
#
# files: String, space-separated glob patterns indicating what files
# are considered source files.
#
# shebang: Optional, string, for language detection only. See
# semantics under "language detection" below.
#
# compile: Optional, string, command to compile or syntax-check the
# source code.
#
# run: String, command to run a program.
#
#
# Language detection
# ==================
#
# Language detection proceeds as follows:
#
# 1. For each language, a file included in the program is considered
# to be a source file if its name matches the "files" glob for the
# language. If the language specifies a "shebang" entry, the
# first line of the file *must additionally* match the shebang.
#
# 2. For each language, count how many files in the program are source
# files for that language.
#
# 3. The language of the program is the one under which the program
# has the maximum number of source files. In case of ties, the
# language that has the highest priority takes precedence.
#
#
# Entry point type
# ================
#
# A language can have three different entry point types, reflecting
# how a program in the language is started:
#
# binary: the compile command produces an executable file
#
# mainfile: name of source code file to pass to interpreter/runtime
# environment as entry point to the program.
#
# mainclass: similar to mainfile, but at a higher level than a file.
# Typical (only?) examples are Java and Java-based
# languages such as Scala.
#
# The entry point type of a language is implicitly specified by using
# one of the four meta-variables {binary}, {mainfile}, {mainclass},
# {Mainclass} defined below. A language specification *must* use
# exactly one of these four metavariables.
#
#
# Metavariables
# =============
#
# The following metavariables are available for use in the "compile"
# and "run" entries of a language.
#
# {path}: path where the source files are located
#
# {files}: list of all source files
#
# {binary}: arbitrary file name that can be defined by the
# implementation.
#
# {mainfile}: * if the program consists of a single source file,
# {mainfile} equals the name of that source file.
# * if the program contains a source file matching the
# glob "[mM][aA][iI][nN].*", {mainfile} equals the name
# of that file (in case of multiple such files,
# behaviour is undefined).
# * otherwise, {mainfile} equals the lexicographically
# smallest source file name
#
# {mainclass}: equals {mainfile} without filename extension.
#
# {Mainclass}: equals {mainclass}, but first letter capitalized.
#
# {memlim}: memory limit
#
---
c:
name: 'C'
priority: 950
files: '*.c'
compile: '/usr/bin/gcc -g -O2 -std=gnu99 -static -o {binary} {files} -lm'
run: '{binary}'
cpp:
name: 'C++'
priority: 1000
files: '*.cc *.C *.cpp *.cxx *.c++'
compile: '/usr/bin/g++ -g -O2 -std=gnu++17 -static -o {binary} {files}'
run: '{binary}'
csharp:
name: 'C#'
priority: 700
files: '*.cs'
compile: '/usr/bin/mcs -out:{binary}.exe -optimize+ -r:System.Numerics {files}'
run: '/usr/bin/mono {binary}.exe'
cobol:
name: 'Cobol'
priority: 50
files: '*.cob'
compile: '/usr/bin/cobc -o {binary} -g -O2 -std=default -free -x -static {files}'
run: '{binary}'
fsharp:
name: 'F#'
priority: 675
files: '*.fs'
compile: '/usr/bin/fsharpc --out:{binary}.exe --optimize+ -r:System.Numerics {files}'
run: '/usr/bin/mono {binary}.exe'
go:
name: 'Go'
priority: 400
files: '*.go'
compile: '/usr/bin/gccgo -g -o {binary} -static-libgcc {files}'
run: '{binary}'
haskell:
name: 'Haskell'
priority: 600
files: '*.hs *.c'
compile: '/usr/bin/ghc -O2 -ferror-spans -threaded -rtsopts -tmpdir {path} -o {binary} {files}'
run: '{binary} +RTS -M{memlim}m -K8m -RTS'
java:
name: 'Java'
priority: 800
files: '*.java'
compile: '/usr/bin/javac -encoding UTF-8 -sourcepath {path} -d {path} {files}'
run: '/usr/bin/java -Dfile.encoding=UTF-8 -XX:+UseSerialGC -Xss64m -Xms{memlim}m -Xmx{memlim}m -cp {path} {mainclass}'
javascript:
name: 'JavaScript'
priority: 500
files: '*.js'
compile: '/usr/bin/nodejs -c {files}'
run: '/usr/bin/nodejs "{mainfile}"'
kotlin:
name: 'Kotlin'
priority: 250
files: '*.kt'
compile: '/usr/bin/kotlinc -d {path}/ -- {files}'
run: '/usr/bin/kotlin -Dfile.encoding=UTF-8 -J-XX:+UseSerialGC -J-Xss64m -J-Xms{memlim}m -J-Xmx{memlim}m -cp {path}/ {Mainclass}Kt'
lisp:
name: 'Common Lisp'
priority: 200
files: '*.lisp *.cl'
compile: '/usr/bin/sbcl --noinform --noprint --non-interactive --eval ''(if (equal (compile-file "{mainfile}") NIL) (sb-ext:exit :code 43) ())'' '
run: '/usr/bin/sbcl --noinform --non-interactive --load "{mainfile}"'
ocaml:
name: 'OCaml'
priority: 375
files: '*.ml'
compile: '/usr/bin/ocamlopt -o {binary} unix.cmxa str.cmxa bigarray.cmxa {files}'
run: '{binary}'
objectivec:
name: 'Objective C'
priority: 300
files: '*.m *.c'
# The postargs for the compile command are '-lm -lobjc `gnustep-config --objc-flags` -lgnustep-base -o {binary}', edited to remove -I. and -I(home dir of user running the command), and to remove duplicate definition of GNUSTEP_BASE_LIBRARY
compile: '/usr/bin/gcc -O2 -std=gnu99 {files} -lm -lobjc -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=2 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -fgnu-runtime -fconstant-string-class=NSConstantString -I/usr/local/include/GNUstep -I/usr/include/GNUstep -lgnustep-base -o {binary}'
run: '{binary}'
pascal:
name: 'Pascal'
priority: 350
files: '*.pas'
compile: '/usr/bin/fpc -o"{mainfile}.out" -O2 -XS -Xt "{mainfile}"'
run: '"{mainfile}.out"'
php:
name: 'PHP'
priority: 450
files: '*.php'
compile: '/usr/bin/php -n -d display_errors=stderr -d html_errors=0 -l {files}'
run: '/usr/bin/php -n -d display_errors=stderr -d html_errors=0 -d memory_limit={memlim}m -f "{mainfile}"'
prolog:
name: 'Prolog'
priority: 100
files: '*.pl'
compile: '/usr/bin/swipl -O -q -g main -t halt -o {binary} -c {files}'
run: '{binary}'
# Python2 with shebang comes before default python3.
python2_with_shebang:
name: 'Python 2'
priority: 860
files: '*.py *.py2'
shebang: '^#!.*python2\b'
compile: '/usr/bin/python2 -m py_compile {files}'
run: '/usr/bin/python2 "{mainfile}"'
python3:
name: 'Python 3'
priority: 850
files: '*.py *.py3'
compile: '/usr/bin/python3 -m py_compile {files}'
run: '/usr/bin/python3 "{mainfile}"'
# Python2 without shebang comes after python3.
python2:
name: 'Python 2'
priority: 840
files: '*.py2'
compile: '/usr/bin/python2 -m py_compile {files}'
run: '/usr/bin/python2 "{mainfile}"'
ruby:
name: 'Ruby'
priority: 650
files: '*.rb'
# Note that this compile command only syntax-checks the main file --
# unfortunately the ruby -c command does not provide the option to
# syntax-check multiple files.
compile: '/usr/bin/ruby -c "{mainfile}"'
run: '/usr/bin/ruby "{mainfile}"'
rust:
name: 'Rust'
priority: 575
files: '*.rs'
compile: '/usr/bin/rustc -o{binary} -O --crate-type bin --edition=2018 {files}'
run: '{binary}'
scala:
name: 'Scala'
priority: 550
files: '*.sc *.scala'
compile: '/usr/bin/scalac -encoding UTF-8 -sourcepath {path} -d {path} {files}'
run: '/usr/bin/scala -J-Xmx{memlim}m -classpath {path} {mainclass}'
scheme:
name: 'Scheme'
priority: 549
files: '*.scm *.rkt'
compile: '/usr/bin/csc -I {path} -o {binary} {files}'
run: '{binary}'