A program that creates another program

how to run a program inside another program
c++ execute another program
how to call a c program in another c program
software.that writes software
program synthesis
automatic code generation tools
c++ execute another program linux
code that writes itself

I need to create a program that creates another program but not a compiler though.

For example,

I write a program that accepts a string input from the user. Let's say user enter "Pluto". This program should then create a separate .exe that says "Hello Pluto" when executed.

How can I do this? If you could give example in C# and Windows Forms, it's better.

Thanks.

Basically that is a compiler - just for a particularly simple language.

If you can express the final program in C#, the easiest solution is probably to use CSharpCodeProvider. That's what I do for Snippy, a little tool to help run code snippets easily for C# in Depth. The source code to Snippy is on the C# in Depth web site and can give you an idea of what you might do - basically you'd just want it to write the executable to a file instead of building it in memory.

Alternatively, look at the MSDN docs which have an example generating an executable.

A program that creates another program, Can be created through the C function call pipe (). This approach means one process must be the parent of the other. Example. Let's say we have the main program, let's call him program 'M'. So 'M' is a program whose only function/method is to create an object/program called 'x'. And 'x' can only create another object/program called 'y'. Each 'y' can complete a simple task with the same rate and they can work together towards achieving the same goal.

The classes you are looking for are in the Microsoft.CSharp namespace

CSharpCodeProvider codeProvider = new CSharpCodeProvider();
ICodeCompiler icc = codeProvider.CreateCompiler();
System.CodeDom.Compiler.CompilerParameters parameters = new CompilerParameters();
parameters.GenerateExecutable = true;
parameters.OutputAssembly = Output;
CompilerResults results = icc.CompileAssemblyFromSource(parameters,SourceString);

(from microsoft support found by using google - taking less than 20 sec)

How to make a program that works with another program, Teaching artificial intelligence to code and create software has been a holy system, database, hardware platform, or another software system. Yes. This is the idea behind program synthesis: automatically generating programs. Current techniques basically do some sort of search through the space of possible programs. Unfortunately, since this space is giganticeven really clever search algorithms do not scale very well. Also, these things tend to scale exponentially, so Moore's law and parallelism will not save us.

Tentatively, you can also achive this throught he use of things in the System.Reflection.Emit namespace and I believe it's possible to provide the implementation of a method through the use of LINQ expression trees. Which is kind of neat:

var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("TestAssembly"), AssemblyBuilderAccess.RunAndSave);
var mod = assembly.DefineDynamicModule("TestModule");
var type = mod.DefineType("TestType");
var method = type.DefineMethod("Increment", MethodAttributes.Public, typeof(int), Type.EmptyTypes);
Expression<Func<int, int>> inc = (a) => a + 1; // this is cool
inc.CompileToMethod(method);

It might look a bit daunting at first, but it's really cool stuff, and you let the compiler generate the hard stuff, the method implementation. But you can't really create fields like this, that's gonna require some IL. Which is great fun but really tedious work.

DISCLAIMER:

I haven't tried to run the above code. But I know it goes something like that, it's been a while since I've done something like that.

New A.I. application can write its own code, There are various ways to run another program from within your own. These functions create and execute a new child process, named by  This page does not provide step-by-step instructions for creating a program as the steps differ depending on the type of program being created and the programming language. Anyone interested in developing software, such as a program, game, or online service, must start by learning a programming language .

The easiest thing to do would be to create (in advance) a really short simple program that reads a resource from itself and prints it. Then your application needs only to place that program binary on disk somewhere and call the UpdateResource function to change the string. .NET also has resource support, but I don't know of any function that directly corresponds to UpdateResource.

Automatic programming, When you create a Windows Forms App project, you actually build a program that runs. In this tutorial, your picture viewer app doesn't do much  The program trained scientists around the world to accomplish that, and had identified 160 new novel coronaviruses before shutting down just before this one, SARS-CoV-2, emerged. Wuhan Institute

Use Reflection.Emit.

http://msdn.microsoft.com/en-us/library/8ffc3x75.aspx

http://www.codeproject.com/KB/cs/DynamicCodeGeneration2.aspx

How to build a HelloWorld.exe using Reflection.Emit (it's less than half-page of code): http://blogs.msdn.com/b/joelpob/archive/2004/01/21/61411.aspx

Run a program from within a program, This how-to guide is an attempt to put you on the path to understanding how programs work by helping you create a program. For this guide to be effective you  When you open Task Manager and click on the Startup tab to manage auto-start entries, you may notice one or more entries showing up as 'Program' showing up with a blank or generic icon and without any Publisher information. The unknown 'Program' entries are most likely caused if both of the following conditions are true: The

Step 2: Run your picture viewer app, To accomplish this function, Tcl has two ways to start another program: open run a new program with I/O connected to a file descriptor; exec run a Write a Tcl script to get a platform-independent program: # # Create a unique (mostly)  I tried copying the problem files to a brand new folder. The files are still "in use" within the new folder. I tried copying an entire folder that is in the "in use by another program" state to a brand new folder. The brand new folder ends up in the "file in use by another program" state as well.

How to Make Your First Java Program : 10 Steps, Many people find great personal satisfaction in creating a set of instructions That is, the programmer prepares the instructions of a computer program and Another is security, since established computer professionals can usually find work. On May 6, 1935, President Franklin D. Roosevelt signs an executive order creating the Works Progress Administration (WPA).The WPA was just one of many Great Depression relief programs created

Running other programs from Tcl - exec, open, The Trump administration on Wednesday formally terminated an Obama-era program that granted Central American minors temporary legal residence in the United States, shutting the door on 2,714

Comments
  • Could you show us what you've gotten done on this homework assignment so far?
  • Looks very much like a code-it-for-me question...
  • I wanted to put "this isn't homework", but i thought you guys would give me the benefit of the doubt. I'm already 27 year old. It isn't "code it for me" question. The problem I face is really much bigger, but I reduce the problem to the simple question above.
  • I think you meant to say, "pervert" (qouting the 2nd ep of star wars). "Machines making machines, how pervert" - C3PO. But it's really not. There's actually folks within the AI community who build systems through generative algorithm that spawns new programs and over time these programs evolve to solve the problem more accuratly. I know of an example where a robot learnd to stand on it's own and then also retain balance if shoved through the use of such an approach. I do not know if this is related to AI or not, but there's a sound reasoning behind all this.
  • The word is 'perverse' not 'pervert'.
  • upvoted just for the sake of it. if you look over the front page, somebody is just downvoting everything he sees.
  • something downvotes everything. Look at the question-list. Many good questions are downvoted. Please stop that bot!
  • People downvoting proper answers makes me want to downvote those downvoters.
  • Please don't use patronizing text in the answer regarding google. The whole point of stackoverflow.com is to not use google and have a coding reference here. Otherwise why don't we all just use google?
  • Because certain things can't really be found by using google, because they are too specific to be found. In this case though, it was really easy to find. Now, if you have a question concerning something you've found (and appear to be spend thoughts on it) I don't have a problem with it.