compiler

Everything else that doesn't fall into one of the other PB categories.
okman
New User
New User
Posts: 5
Joined: Fri May 21, 2004 5:06 pm

compiler

Post by okman »

guyz i was deciding to create some sort of program like pb itself using pb. an idea striked me. is it possible to alter a text file which has been embedded into another program using pb. my concept is here. its not always necessary to create a full machine code exe. this is very basic. i create an exe which has a text file embedded in it. i rename the extension to be something else. i make another program. you can write code in that prgram. the program will then compile it, not really do it. it will create a text file containing my code and encrypt/compress {watever} it. then create the copy of the exe containing text file and replace the text file resource with the text file containing code. then the pre programmed exe is programmed to decrypt the embedded text file and read all the commands in it and execute it. is this realy possible? quite simple uh.
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

sounds like an interpreter, with source code included...

yes, it can be done
but why would you?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Kale
PureBasic Expert
PureBasic Expert
Posts: 3000
Joined: Fri Apr 25, 2003 6:03 pm
Location: Lincoln, UK
Contact:

Post by Kale »

Im assuming that you are talking about embedding another language in your exe? This has been done with Lua before:
viewtopic.php?t=8056

To modify data held inside an exe try this link for a simple way of doing it:
viewtopic.php?t=9744
--Kale

Image
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

This approach definately workds. Visual Dialogscript used it very well (don't know about now).

I think Blueznl does have a point though.

I think one of the things PB shows is that scripting langauges aren't really necessary. Purebasic is just as flexible and agile, but produces executables that are smaller and faster.
BalrogSoft
Enthusiast
Enthusiast
Posts: 203
Joined: Sat Apr 26, 2003 6:33 pm
Location: Spain
Contact:

Post by BalrogSoft »

Take a look to my language ScriptVM, the source code is available, dowload it on http://www.balrogsoftware.com/scriptvm, the scriptvm.pb file begins reading the virtual code file added to the executable, and svm-comp.pb generates the virtual code and the executable with the code attached, if you dont need to generate a virtual code, you only need to join an exe and a text file, you can take a look to the line 321 on my compiler, it shows how to create the executable with the file attached. You can take also to this: viewtopic.php?t=8573, I hope it help you...
Post Reply