Skip to main content

Questions tagged [code-generation]

For challenges where answers are expected to generate code.

Filter by
Sorted by
Tagged with
16 votes
11 answers
2k views

When code golfing, it can be useful to write numbers succinctly. This challenge involves using a source language to generate code for a target language. For the submission to be valid, it must ...
Charles's user avatar
  • 3,071
13 votes
12 answers
2k views

Introduction Bespoke is an esoteric programming language I created in January 2025, where the commands are encoded into the lengths of words in the program. For example, ...
Josiah Winslow's user avatar
7 votes
3 answers
921 views

There was a prior question about golfing an HQ9+ compiler that translates HQ9+ code into the language it is written in, but that was closed as a duplicate of the interpreter challenge because ...
Someone's user avatar
  • 1,252
20 votes
31 answers
3k views

Your challenge, should you choose to accept it, is to write a program in a language of your choice that, when given a string (limited to printable ASCII) as input, outputs a new program in the same ...
noodle person's user avatar
18 votes
24 answers
3k views

Write a program or function that takes input and outputs/returns a full program (in the same language) that outputs said input. Note that the input may contain any printable ASCII character or newline ...
Dadsdy's user avatar
  • 2,105
6 votes
1 answer
658 views

Usually each cell in brainfuck has 256 states, which is not enough to tell whether input is EOF or a character (usually \xFF but ...
l4m2's user avatar
  • 32.5k
4 votes
2 answers
394 views

Robbers thread In this cops-and-robbers challenge, your task is to write a program h that outputs "Hello Shue!". Next, you have to choose a string ...
AnttiP's user avatar
  • 8,048
19 votes
2 answers
648 views

Content You count numbers every day (I think), and most of you know how to count properly, the one next to 1 is 2, and the next ...
okie's user avatar
  • 1,807
5 votes
2 answers
1k views

Challenge Given two lists of strings where each string is of length 50 and each list is also of length 50 generate the shortest regex you can that fully matches all the strings in the first list and ...
user197974's user avatar
  • 1,161
18 votes
12 answers
3k views

A polyglot is a program that runs in several languages. Your challenge is to: Choose at least two languages (Different versions count as different languages) Create a program or function that takes ...
emanresu A's user avatar
  • 46.2k
12 votes
3 answers
576 views

The program should start out with 2 separate files, here named "a" and "b". "a" and "b" should be what I am calling inverse quines: "a", when run, ...
blueberry's user avatar
  • 221
13 votes
9 answers
2k views

This is the Robbers thread. For the Cops challenge, see here As the robbers, your job is to crack the cops' answers. Choose an uncracked, unsafe cop answer and attempt to figure out which languages, ...
caird coinheringaahing's user avatar
9 votes
6 answers
985 views

Introduction Ah, INTERCAL... As much as I'd like encourage everyone to Try it Online, text output is just painful. According to the docs it uses the "Turing Text Model". While an... ...
mindoverflow's user avatar
  • 1,083
24 votes
19 answers
26k views

Inspired by this blog post. Write a program that outputs 99 distinct programs (in the same language) that output the string I love you. How the programs are ...
Mason's user avatar
  • 2,175
3 votes
9 answers
964 views

Background Joe is working on his new Brainfuck answer on Codegolf. The algorithm he's using to solve the challenge is a bit complicated, so Joe came up with idea of simplifying his Brainfuck notation ...
Kamila Szewczyk's user avatar
7 votes
2 answers
429 views

Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code. Aheui is esolang written in only Korean character. Because of ...
LegenDUST's user avatar
  • 979
8 votes
1 answer
488 views

Create a program (any language) which, given positive integer m, outputs a valid C expression that: Uses a single variable x ...
fgrieu's user avatar
  • 615
37 votes
32 answers
4k views

Challenge Your task is to write a piece of code that outputs another piece of code. That code must in turn output yet another code until the final code outputs the integer 1. The chain ends the first ...
Stewie Griffin's user avatar
4 votes
4 answers
368 views

Your challenge is to implement a cyclic Program Sequence Generator (PSG) in a language of your choice. Given a language, L, a PSG in L is a program in L that outputs a PSG in L. Some properties of a ...
Vaelus's user avatar
  • 609
30 votes
79 answers
4k views

Write a piece of code that takes a string as input, and outputs a piece of code in the same language that, when run, will output the initial input string. It must be able to handle any combination of ...
quartzic's user avatar
  • 417
4 votes
1 answer
391 views

A Ken Thompson virus is a virus that infects your compiler and other programs. Since it infects all your tools, you can not detect it without using tools from before the virus was introduced. Your ...
Christopher King's user avatar
18 votes
9 answers
726 views

Wise is a simple bitwise language I designed a while back. It is based around Python's bitwise operations. It has several operations most of these are the same or very similar to the equivalent ...
Wheat Wizard's user avatar
  • 103k
2 votes
7 answers
1k views

Mike Bufardeci (Pyth) - 175 bytes Leo (Retina) - 175 bytes devRicher (Lua) - 182 bytes Peter Taylor (CJam) - Waiting for clarification Lyth (C++11) - Waiting for clarification Edit: Several ...
Julian Lachniet's user avatar
16 votes
9 answers
907 views

In this challenge you'll be building a program that grows as it traverses through the ages… Until it's 2017. Challenge Whenever this challenge description says “program”, you can ...
user2428118's user avatar
  • 2,076
22 votes
14 answers
3k views

Concept Write a program that outputs code in its programming language. That code, when executed, must output the original program. Rules Since this is a cheating quine, you can read the original ...
anna328p's user avatar
  • 6,482