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.

11
votes
4answers
747 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 ...
8
votes
3answers
771 views

Self-shortening Prime Tester

Let's get right in to it. Your challenge is to make a program that does these things depending on its input: If the input is a number, output "Prime" if the number is a prime number and "Not prime" ...
11
votes
8answers
901 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 ...
15
votes
5answers
961 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...
18
votes
8answers
1k views

Generalized Quine Generator

The Challenge In this challenge, you specify a source language S and a target language T. Your task is to write the following ...
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 ...
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 ...
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 ...
104
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 ...
8
votes
1answer
659 views

Create self-extractor script (relaxed rules)

This is the target language-relaxed version of Generate a self-extractor application Create a program in any language, that takes an arbitrary binary input, and generates a valid program (also in any ...
5
votes
2answers
530 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 ...
17
votes
2answers
937 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 ...
17
votes
4answers
2k views

Convert Fractran into Brainfuck

Background Fractran is an esoteric Turing-complete programming language invented by John Conway. A Fractran program consists of an ordered list of fractions. The program starts by taking a single ...