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 »
Challenges

Comments on Keyword golfing

Post

Keyword golfing

+6
−0

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

History
Why does this post require attention from curators or moderators?
You might want to add some details to your flag.
Why should this post be closed?

2 comment threads

Can a keyword be a single character? (5 comments)
Is it OK to output something and wait for a input? (2 comments)
Can a keyword be a single character?
H_H‭ wrote about 1 year ago · edited about 1 year ago

Can a keyword be a single character?

Or to ask a bit more general: What exactly do you define as a keyword for this challenge?

Lundin‭ wrote about 1 year ago

H_H‭ This is defined by the official programming language specification. Like in the example given, by the ISO standard. Some languages might not have one (most esoteric programming languages don't) and then this challenge might not be suitable for that language.

H_H‭ wrote about 1 year ago

Can you please specify this in the post? This is a huge restriction so far not mentioned.

Please keep in mind that there are real world languages that don't have a language specification, for example rust.

Lundin‭ wrote about 1 year ago

H_H‭ I think the first sentence of the challenge already explains this pretty well.

H_H‭ wrote about 1 year ago · edited about 1 year ago

There is no word about specification or anything like that. For me, the requirement to have a official programming language specification, one that exactly specifies what a keyword is and what not is a totally different requirement than just the requirements of having the concept of keywords.