Making a compiler which produces EXE files
-
Hi. I know how to write an interpreter which can execute a program written in my own language. I want to know how I can implement the functionality so that the program can be made an independent EXE file which will run without the need of an interpreter. (Just like the VC++ compiler&linker do). Waiting 4 reply.
-
Hi. I know how to write an interpreter which can execute a program written in my own language. I want to know how I can implement the functionality so that the program can be made an independent EXE file which will run without the need of an interpreter. (Just like the VC++ compiler&linker do). Waiting 4 reply.
It's A LOT of work. First of all you need to produce assembly which of course should be machine-dependent, meaning that you should produce a different instruction set for each different machine. Assembly in x86 CISC architecture is quite chaotic. Then you either need to create a linker or use one that already works in order to make that assembly into binary code. I 've tried that for the SPARC (RISC) architecture. In order to produce the proper assembly you really need to know a lot about the CPU architecture and read the manufacturer's manuals carefully. Good luck should you try anything like that, Themis
-
Hi. I know how to write an interpreter which can execute a program written in my own language. I want to know how I can implement the functionality so that the program can be made an independent EXE file which will run without the need of an interpreter. (Just like the VC++ compiler&linker do). Waiting 4 reply.
I think the easiest way to do that would be to generate code in an intermediate language, like C. Then you can compile and link using standard tools. In addition you'll take advantage of the optimization of the intermediate compiler that way. /moliate
The corners of my eyes catch hasty, bloodless motion - a mouse? Well, certainly a peripheral of some kind.
Neil Gaiman - Cold Colours
-
Hi. I know how to write an interpreter which can execute a program written in my own language. I want to know how I can implement the functionality so that the program can be made an independent EXE file which will run without the need of an interpreter. (Just like the VC++ compiler&linker do). Waiting 4 reply.
You'll need to become intimately familiar with the PE file format.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow