Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Sandbox

Post History

71%
+3 −0
Sandbox Keyword golfing [FINALIZED]

posted 3y ago by Lundin‭  ·  edited 1y ago by trichoplax‭

#3: Post edited by user avatar trichoplax‭ · 2023-06-19T10:24:32Z (over 1 year ago)
Add finalized tag now that the sandbox can be filtered to exclude tags
Keyword golfing [FINALIZED]
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 most compile cleanly with a conforming compiler. 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):

```c
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

```
#2: Post edited by user avatar Lundin‭ · 2022-02-04T12:19:35Z (almost 3 years ago)
  • Keyword golfing
  • Keyword golfing [FINALIZED]
#1: Initial revision by user avatar Lundin‭ · 2021-12-15T11:45:04Z (about 3 years ago)
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 most compile cleanly with a conforming compiler. 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):

```c
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

```