Comments on Keyword golfing
Parent
Keyword golfing
Many programming languages have the concept of keywords, special syntax items that are not just identifiers reserved by some library, but words reserved by the language itself.
The challenge is to write a minimal program for a language with such keywords, with as few characters as possible (code golf), while at the same time using every single keyword from the language.
The program need not do anything meaningful or perform any particular input/output, but it must compile cleanly with a conforming compiler and execute without run-time errors/crashes. Non-standard extensions and alternative non-standard keywords shall not be used.
Example, all keywords from the C language (as per the current C17 standard):
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
inline
int
long
register
restrict
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while
_Alignas
_Alignof
_Atomic
_Bool
_Complex
_Generic
_Imaginary
_Noreturn
_Static_assert
_Thread_local
[Python 3.7], 231 bytes …
2y ago
Ruby 3.1.0, 274 259 249 bytes …
2y ago
Scala 3, 553 bytes ```scala …
2y ago
Lua 5.4.4, 147 bytes ``` l …
2y ago
BQN, 107 bytes ``` A↩C←A⇐¯ …
2y ago
[C (gcc)], 358 bytes …
1y ago
Post
Python 3.7, 231 bytes
class C:pass
def g():
async def f():return;yield;await[3for()in()];nonlocal f
if None:
with lambda:3or 7and 8as q:del x
elif False:raise
else:assert 1is not 5
try:from x import*
except:global a
finally:9
while True:break;continue
2 comment threads