Exe help [SOLVED]

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Exe help [SOLVED]

Post by tappatekie »

Hey guys, can anyone give me a reference as to how Executable files are processed by a modern Windows operating system? The reason for this is that I plan to make a compiler in C# to compiler code from a my own scripting language to executable.

I don't intend to use IL code either...
I do understand that this would be VERY complex to make...
Last edited by tappatekie on Tue May 15, 2012 5:21 pm, edited 1 time in total.
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Exe help

Post by bbguimaraes »

Usually you just pass the file as an argument to the interpreter. So:

Code: Select all

$ plywood file
I'm running your file! =)
And I don't know about windows, but in unix you can begin the file with the line

Code: Select all

#!/bin/plywood
That line tells which program to use to interpret the file, so you can execute it directly:

Code: Select all

$ chmod +x file
$ file
I'm running your file! =)
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Exe help

Post by tappatekie »

bbguimaraes wrote:Usually you just pass the file as an argument to the interpreter. So:

Code: Select all

$ plywood file
I'm running your file! =)
And I don't know about windows, but in unix you can begin the file with the line

Code: Select all

#!/bin/plywood
That line tells which program to use to interpret the file, so you can execute it directly:

Code: Select all

$ chmod +x file
$ file
I'm running your file! =)
Erm... I meant actually writing my own compiler in c# to generate an executable (.exe) version of the plywood script. Was looking for any references to get me started writing this compiler to be understood as an exe...

Or, I choose an easier way out :L, use .Net's CodeDomCompiler class to compile converted plywood source code to c#?
User avatar
bbguimaraes
Chaos Rift Junior
Chaos Rift Junior
Posts: 294
Joined: Wed Apr 11, 2012 4:34 pm
Programming Language of Choice: c++
Location: Brazil
Contact:

Re: Exe help

Post by bbguimaraes »

Oh, I thought you just wanted to make it "executable". Sorry.

Generating machine language would be really hard, as it is completely platform dependant (requiring one implementation for each platform), as far as I know. You could translate it to another language that is already portable, like C# (or ANSI C ;)), then compile it. But take a look at existing interpreted languages that offer pre-compilation to see how they handle it.
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Exe help

Post by tappatekie »

bbguimaraes wrote:You could translate it to another language that is already portable, like C# (or ANSI C ;)), then compile it. But take a look at existing interpreted languages that offer pre-compilation to see how they handle it.
Will do ;) (c#), i'l start developing the compiler later :D
And maybe, you'l see the compiler in action for Episode 2 :O
User avatar
OmenFelix
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 59
Joined: Fri May 04, 2012 1:42 pm
Current Project: Arcadian Descent(C++, SDL, KOS)
Favorite Gaming Platforms: PS2, PC, XBOX, NDS
Programming Language of Choice: C/C++

Re: Exe help

Post by OmenFelix »

tappatekie wrote:
bbguimaraes wrote:You could translate it to another language that is already portable, like C# (or ANSI C ;)), then compile it. But take a look at existing interpreted languages that offer pre-compilation to see how they handle it.
Will do ;) (c#), i'l start developing the compiler later :D
And maybe, you'll see the compiler in action for Episode 2 :O
I'd highly suggest you use IL and base your compiler on this source: http://msdn.microsoft.com/en-us/magazine/cc136756.aspx. I've made many a simple .net language using that. If you struggle understanding the code then I'd advise you check out: http://www.youtube.com/casandramar

Casandramar is an old friend, and through working on a compiler with him, I grew greater knowledge of compiler development --a long time ago though. He doesn't update his channel any more, but nonetheless he has videos on using that source to make his own .net compiler and one you can make. Through watching his videos or just general-research you will gain knowledge of EBNF and BNF.

Anyway, good luck with your endeavours. ;)
Why not check out my game-development forum at: http://f1rel0ck.netai.net
Or my 2D RPG at: https://www.facebook.com/pages/Arcadian ... 6873806531
Image
Image
Image
tappatekie
Chaos Rift Junior
Chaos Rift Junior
Posts: 204
Joined: Mon Nov 21, 2011 3:01 pm
Current Project: Web browser from scratch
Favorite Gaming Platforms: SNES, PSP, PS1 and 3
Programming Language of Choice: C#
Location: A house near me
Contact:

Re: Exe help

Post by tappatekie »

OmenFelix wrote:
tappatekie wrote:
bbguimaraes wrote:You could translate it to another language that is already portable, like C# (or ANSI C ;)), then compile it. But take a look at existing interpreted languages that offer pre-compilation to see how they handle it.
Will do ;) (c#), i'l start developing the compiler later :D
And maybe, you'll see the compiler in action for Episode 2 :O
I'd highly suggest you use IL and base your compiler on this source: http://msdn.microsoft.com/en-us/magazine/cc136756.aspx. I've made many a simple .net language using that. If you struggle understanding the code then I'd advise you check out: http://www.youtube.com/casandramar

Casandramar is an old friend, and through working on a compiler with him, I grew greater knowledge of compiler development --a long time ago though. He doesn't update his channel any more, but nonetheless he has videos on using that source to make his own .net compiler and one you can make. Through watching his videos or just general-research you will gain knowledge of EBNF and BNF.

Anyway, good luck with your endeavours. ;)
Will do, however I won't be developing the compiler yet for a while :P
Post Reply