vishapoberon / compiler

vishap oberon compiler
http://oberon.vishap.am
GNU General Public License v3.0
186 stars 25 forks source link

Steps to prepare voc compiler #28

Open snayaksnayak opened 8 years ago

snayaksnayak commented 8 years ago

I am interested to know the steps we follow to prepare voc compiler. Below are my guesses. Kindly correct them.

To make voc, only requirement was gcc on my linux machine. But most of the code for this compiler is written in Modula-2. Also we use ofront to convert .Mod to .c. I am trying to co-relate these three statements and guess how you could have proceeded.

First build ofront using gcc. Is ofront source written in C? Then convert Modula-2 sources of voc to .c files. Now compile them using gcc.

Am I mistaken? Kindly correct me.

norayr commented 8 years ago

compiler is written in Oberon. It's openhub and github that do not distinguish oberon from modula-2.

ofront itself was written in Oberon system first. It then generated C files from inside the Oberon system. If you compile Ofront from the Oberon system to C files, then compile those C files on Unix, you get Ofront running on Unix. But it is written in Oberon, and can compile it's own source in Oberon to C, then binary files.

Just forget about steps that require C compiler.

In case of voc, there are bootstrap binaries for different architectures and operating systems. For instance: vocstatic.linŭ.gcc.x86_64 is a statically compiled voc for linŭ, which automatically runs gcc after it compiled Oberon source code to C. Eventually bootstrap binary compiles Oberon source code to object files. They get linked to become the same binary compiler. This time it's called just voc.

Then newly created "voc" is used to compile rest of the library modules.

So there is a binary compiler in distribution that creates itself. md5sums of bootstrap binaries and generated binaries are the same.

The C compiler part does not matter. Source have been written in Oberon. Binaries that were compiled from Oberon source code are able to generate the same binaries from the same source code.

It does not matter, if there is a C compiler invoked or assembler. C compiler can be considered just a portable assembler here. You have Oberon source code as the input and native code binary object files as the output.

norayr commented 8 years ago

you can try to read makefile to understand it better.