-8
\$\begingroup\$
  • Your program must contain all your language's keywords. Ideally, you should have each one exactly once (see Scoring). Of course, this means your language must actually have keywords, so esoteric languages are probably excluded, but just in case...
  • Any language used must have a dedicated Wikipedia article created more than one month ago.
  • The keywords in your program must be lexed as keywords and parsed as keyword statements or expressions (i.e. no containing them within strings or comments).

A "keyword" is defined according to the language's specification or documentation if it has no specification, and must additionally have a defined purpose within the language (Java programmers need not include goto and const). Your language might distinguish "keywords" from "reserved identifiers" or something similar; only those lexemes designated as keywords are required.

Scoring

So as not to punish languages with more keywords, your score is

l - k + 3r

Where l is the length of your program in bytes, k is the combined length of all the keywords you used, and r is the combined length of any keywords that occurred more than once. So if your language has only one keyword, for, and your solution is for for for, your score is 11 - 9 + 3(6) = 20.

\$\endgroup\$
5
  • 2
    \$\begingroup\$ This is trivial. If a program is just each keyword one time and exactly nothing else, that is a trival score of 0. It's also overly broad, since it doesn't specify what the program must do. \$\endgroup\$ – James Mar 21 '16 at 6:05
  • 2
    \$\begingroup\$ @MyHamDJ This is non-trivial, since few languages can simply paste all the keywords in order and have the program compile. \$\endgroup\$ – EMBLEM Mar 21 '16 at 6:51
  • \$\begingroup\$ I believe the standard is "wikipedia, rosetta code, and/or esolang", why just wikipedia specificially? \$\endgroup\$ – SuperJedi224 Mar 22 '16 at 11:13
  • \$\begingroup\$ @SuperJedi224 I dislike the use of esoteric languages on this site. \$\endgroup\$ – EMBLEM Mar 22 '16 at 16:36
  • 1
    \$\begingroup\$ @EMBLEM But they are allowed, and disallowing them is frowned upon. \$\endgroup\$ – James Mar 22 '16 at 16:46
6
\$\begingroup\$

Python 3.4, 110

from os import*
def k(z):
 def c():return None;nonlocal z
class F:pass
global b
with open(devnull)as b:
 while b:
  if 1and 0is 0:continue
  elif 1:0
  else:
   for d in[]:yield not d;del d;break
 try:raise 1or False
 except:assert True
 finally:(lambda j:0)

Uses every keyword once. Note, in Python 3, exec and print are functions, not keywords.

\$\endgroup\$
1
3
\$\begingroup\$

Brainfuck, 0

+-[]><,.

Score:

l = 8
k = 8
r = 0

l - k + 3r = 0

This program takes an input from the user and then prints it.

\$\endgroup\$
9
  • 3
    \$\begingroup\$ This language does not have keywords and is ineligible. \$\endgroup\$ – EMBLEM Mar 21 '16 at 6:51
  • 1
    \$\begingroup\$ Depends what you mean by keyword. \$\endgroup\$ – wizzwizz4 Mar 21 '16 at 16:30
  • \$\begingroup\$ @wizzwizz4 I clearly stated that keywords were defined according to the language specification. The word "keyword" appears nowhere on the Wikipedia or Esolangs page. \$\endgroup\$ – EMBLEM Mar 22 '16 at 16:35
  • 1
    \$\begingroup\$ @EMBLEM The word "keyword" appears nowhere on most Esolangs pages. \$\endgroup\$ – wizzwizz4 Mar 22 '16 at 16:43
  • \$\begingroup\$ @wizzwizz4 That's the idea. \$\endgroup\$ – EMBLEM Mar 22 '16 at 17:04

Not the answer you're looking for? Browse other questions tagged or ask your own question.