Skip to main content
gamedev.net
🔒 Locked

Program that creates EXE's

Started by ELS1 7 replies 700+ views
Original Post
ELS1
ELS1
hello all. i was just wondering if there was a way to actually make your program create executables? im currently writing a small scripting program that does simple tasks, but would like to be able to compile those into EXEs...what all do I need to know/learn about this process? Im currently at work and time is very scarce...so i have to get going... thanks for info/links
RuneLancer
RuneLancer
How good are you with your programming language of choice? What you''re asking could be a very difficult thing. You have a possibilities.


  1. Write a full-blown compiler, which is extremely difficult for someone with anything less than veteran-level skills (but bloody fun and educational!)

  2. Have an interpreter .exe that would take the script filename as a parameter and execute it.

  3. As above, but integrate the script directly in the executable (as a resource) and parse it on the fly. Probably the best solution.
Sandman
Sandman
Basically you want to write a compiler, which will involve converting your script statements into machine code, and then recording the whole thing in .exe format.

A quick google search turned up this, which might be a helpful starting place.

EDIT ^^^^ yes, option 3 sounds like the best alternative to writing a full blown compiler.

[edited by - Sandman on April 1, 2004 9:19:48 AM]
dathui
dathui
quote:
Original post by RuneLancer
How good are you with your programming language of choice? What you're asking could be a very difficult thing. You have a possibilities.


  1. Write a full-blown compiler, which is extremely difficult for someone with anything less than veteran-level skills (but bloody fun and educational!)

  2. Have an interpreter .exe that would take the script filename as a parameter and execute it.

  3. As above, but integrate the script directly in the executable (as a resource) and parse it on the fly. Probably the best solution.



as time is very scarce i would suggest using the 3rd option, include the wm in each .exe and add the script as a resource.writing a friggin compiler can take a while...



reality is only an option

[edited by - dathui on April 1, 2004 9:19:40 AM]
reality is only an option
Skizz
Skizz
Well, if you''re OK sticking with windows, then create an executable that loads the script to process from a binary resource. Your ''script compiler'' is a simple task involving the following:

a) parsing the script and making sure there''s no errors (will speed up the run-time as it can assume the script is OK)
b) convert the script into a byte code format (can be as simple as tokenising the script or as complex as creating your own machine code and virtual machine to run it like Java)
c) Insert byte code into resource of executable.

Modifying resources is much simpler than trying to create executables - there''s no relocation tables, entry points, external library references and loads of other stuff to worry about. You can even store the outputted executable as a binary resource of the compiler.

Skizz
haro
haro
C# is your friend here. Read this. Writing a C# program to compile arbitrary C# code is rediculously trivial.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.