Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [code-generation]

For challenges where answers are expected to generate code.

105
votes
40answers
29k views

Program that creates larger versions of itself (quine-variant)

You are to write a program that will output source code that is Larger than the original program (character wise) Will print another program larger than itself when run (i.e. the new program is also ...
17
votes
2answers
938 views

Compile Regexes

In this task you have to write a program that reads a regular expression and generates another program that outputs whether an input string is accepted by that regular expression. The output must be a ...
21
votes
7answers
898 views

Generate Programs in Increasing size

In this challenge, you will write a program which outputs a program which is the double the length of the original program. The outputted program should output a new program a program double its ...
35
votes
73answers
5k views

Generate ;# code

Related to: Make a ;# interpreter In the above linked challenge the task was to create an interpreter for the esoteric language ;#. The ...
2
votes
7answers
828 views

Kolmogorov Complexity Meta Golfer

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 changes ...
32
votes
7answers
1k views

Three polyglots, two period-two quines, and one code-golf challenge

Produce a program A such that running it in language A produces Program B, and running program A in language B produces program C. Program B, when run in language B produces Program A, and running ...
5
votes
3answers
747 views

Quit Whining; Start Quining

Goal: Write a function or program that, given an integer n, will output a program in the same language that is a quine with a period of ...
5
votes
3answers
373 views

Quine permutation group [duplicate]

Write a program or function which, when run, outputs another program or function which is valid in the same language as the original program, and which itself will output another program or function ...
67
votes
18answers
10k views

Rube Goldberg Hello World

For this golf, you will need to use more than one language. The task A Rube Goldberg machine is a contraption that takes an enormous number of complicated steps in order to execute a very simple ...
35
votes
27answers
3k views

Code-generator with unique characters

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 ...
17
votes
13answers
2k views

Create a FizzBuzz compiler

Welcome to the world of compiler golf. Your task is to write a program that generates another program to play a variant of FizzBuzz on spec. Your compiler Write a compiler that generates variants of ...
25
votes
10answers
3k views

Chaining Programs

Challenge In this challenge, you will be writing the first program, p1, of an infinite sequence of programs, in which running pn outputs/generates program pn+1. When concatenating the first n >= 2 ...
22
votes
30answers
4k views

Produce a m*n table in HTML

Input : Two decimal integers m and n that respectively give the number of rows and columns of the table. ...
28
votes
2answers
870 views

Convert Brainfuck to MarioLANG

MarioLANG is a two-dimensional programming language where the source code resembles a Super Mario Bros. level. Furthermore, its instruction set is very similar to Brainfuck's. This means that ...
18
votes
11answers
1k views

Output a program that outputs a program … that outputs PPCG

Challenge: Write a code that, when executed will output the source code of a second program that can be executed in another language. The second program should output the source code of a third ...
16
votes
9answers
759 views

Grow Till It's 2017

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 ...
14
votes
6answers
1k views

Fibonacci program lengths

Write a program with length n that outputs another program whose length is the next Fibonacci number after n. The new program must do the same thing - output another program whose length is the next ...
5
votes
2answers
533 views

Generate a self-extractor application

Create a program in any language, that takes an arbitrary binary input, and generates a valid C++11 program, which when compiled and run will print this binary input. So you could do this (on linux ...
3
votes
3answers
632 views

Do not repeat yourself

Inspired by this challenge Given a number m, output a program that prints out the string Do not repeat yourself. Now for the ...
31
votes
11answers
2k views

1-up your average quine

A 1-up quine is a program which is very similar to a quine. The one major difference is that instead of printing itself once, when n copies of the program are concatenated, the result prints the ...
25
votes
6answers
3k views

Big big numbers

Whilst trying to golf several of my answers, I've needed to write large integers in as few characters as possible. Now I know the best way to do that: I'll be getting you to be writing this program. ...
18
votes
4answers
784 views

Growing Quine Sequence

You are to write a sequence of 10 programs p1 p2 ... p10 that satisfy the following properties: pK prints ...
14
votes
2answers
919 views

Translate RoboCritters into Brainf***

RoboCritters (etymology) is a brand new esoteric programming language (don't bother searching for it, I just invented it). It's a variant of Brainfuck (BF), slightly more complex than the usual ...
11
votes
8answers
906 views

Generate a Brainf_ck program that outputs a string of given length

Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the ...
10
votes
16answers
1k views

Code golf for the lazy

Your goal in this code golf is to take two strings, language and code (if the golfed code you wrote for this is multiline, then ...
19
votes
18answers
2k views

Write a Metaquine

A metaquine is a program which is not a quine, but whose output, when run as a program in the same language, is a quine. The goal of this challenge is to write a metaquine. This is code-golf, so ...
14
votes
5answers
966 views

Make any number by repeatedly adding 2 numbers

You are given a machine with two 16-bit registers, x and y. The registers are initialized x=1...
11
votes
4answers
761 views

Encoding an URL in brainfuck

Inspired by this question, your goal today is to encode an URL in brainfuck. My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an ...
10
votes
4answers
456 views

Write a Semiquine

Suppose you have 2 languages, A and B. A string s is a semiquine in ...
2
votes
2answers
309 views

Generate code in another language [duplicate]

Write a program in language A which outputs a program in language B where: Language A != Language B The output is itself a solution to this question. This is a popularity contest. If you want to ...