Page 1 of 1

Exe help [SOLVED]

Posted: Fri May 04, 2012 3:20 pm
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...

Re: Exe help

Posted: Fri May 04, 2012 3:53 pm
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! =)

Re: Exe help

Posted: Fri May 04, 2012 3:56 pm
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#?

Re: Exe help

Posted: Fri May 04, 2012 5:40 pm
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.

Re: Exe help

Posted: Fri May 04, 2012 5:46 pm
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

Re: Exe help

Posted: Fri May 11, 2012 10:05 am
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. ;)

Re: Exe help

Posted: Sat May 12, 2012 6:36 pm
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