Compiler programming question

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
yonami
Posts: 20
Joined: Tue Mar 07, 2006 12:00 am

Compiler programming question

Post by yonami »

Hi all.

I need to ask you guys, do you know some sites about compilers programming?

I looking for information how to make a machine code (as boot binary for mbr) using my own compiler... :|
All what I can to do now is generating asm code.

Or maybe someone of you guys know and can to do that? Would you like to help me with my project?

I am developing my own language for my own system. It is importand as all what I am doing now to make my system working. :D

Any suggestion?
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

Compilers generally just convert a programming language into assembly language, and the assembler does the rest.

It sounds like you've already got that working... I think you're on the right track. I don't see why you'd want to compile right down to machine language?

Unless you've got some truely new and unique assembly syntax (as which point I'd have to ask... why?) then I'd recommend using a proven, pre-developed assembler.

--Jeff
yonami
Posts: 20
Joined: Tue Mar 07, 2006 12:00 am

Post by yonami »

I don't see why you'd want to compile right down to machine language?
'Cose my system will be not prosix compatible. So, I need my own compiler for :]

Now I am working under boot mode library. This mode is making code for bootloaders. 512 MBR binary + rest autoloaded by 512 part.

Next step is developing kernel with that language and then system applications :-)

Step by step, but it is a nice fun :-)
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

yonami wrote:
I don't see why you'd want to compile right down to machine language?
'Cose my system will be not prosix compatible. So, I need my own compiler for :]
Assuming you mean *posix*, the two are completely exclusive. A compiler compiles language syntax into assembly language... whether that code complies with posix is irrelevant.
yonami wrote: Now I am working under boot mode library. This mode is making code for bootloaders. 512 MBR binary + rest autoloaded by 512 part.
You're writting your own language for a bootloader? I'm just curious what you expect to gain by doing so? I can definitely see writting an OS kernel in a new language... I think you could probably make very good use of it, in such a forum... but in a bootloader, it seems a bit overkill -- at least to me. I may not be understanding what you're trying to do though... I'm curious.
yonami wrote: Next step is developing kernel with that language and then system applications :-)
This I definitely understand. I considered writting my own language for my kernel as well. I'm still writting the language/compiler, but the OS is written in C, for the time being (I wanted to write the experimental OS on a proven compiler, to eliminate one potential area for bugs).

Again, though, I'll stress that you can still have a compiler convert language syntax to assembly, and have the assembler to the rest *and* have a non-posix system. The two are not tied to each other at all.

Cheers,
Jeff
DeletedAccount
Member
Member
Posts: 566
Joined: Tue Jun 20, 2006 9:17 am

Hello

Post by DeletedAccount »

Register at ebooksclub.org and download as many books as you can..
yonami
Posts: 20
Joined: Tue Mar 07, 2006 12:00 am

Post by yonami »

Again, though, I'll stress that you can still have a compiler convert language syntax to assembly, and have the assembler to the rest *and* have a non-posix system. The two are not tied to each other at all.
I can use asm compiler now, but here is a one big problem. I must write asm compiler for my OS. I am using linux at now, but in a future.... i will using my OS. So I need full compiler (all in one) to compile applications under and for that OS :-)
You're writting your own language for a bootloader?
Nope. I am writing module to generate asm code for bootloaders. This is different thing than compiling an applications.
Compiler must generate code for first 512 bytes, and that part must load extended bootloader part. Then I give you (as a programmer) i/o functions and objects to handle fat*, reiserfs, etc. files. You must write kernel loading binary only. And then you can write kernel sources using the same and more libraries. But you must know ASM too if you want to write low level parts of your code.

The most important thing is OPTIMALIZATION. And here is a reason why I want to write some modules for different binary formats assignments. "Boot" for bootloaders (simble module), "Kernel" for kernels, etc. OPTIMALIZATION exactly is a reason why I do that.
Assuming you mean *posix*, the two are completely exclusive
Yes. Letter bug :-)

Give me some time - I must finish the most basics first, and then you see my publication :-)
User avatar
carbonBased
Member
Member
Posts: 382
Joined: Sat Nov 20, 2004 12:00 am
Location: Wellesley, Ontario, Canada
Contact:

Post by carbonBased »

yonami wrote: I can use asm compiler now, but here is a one big problem. I must write asm compiler for my OS. I am using linux at now, but in a future.... i will using my OS. So I need full compiler (all in one) to compile applications under and for that OS :-)
Unless you're doing anything drastically different and new, I would suggest porting an existing compiler (or your own, as it sounds like you're fairly far with it already) and an existing assembler (gas, nasm, etc).

Porting an assembler is usually pretty simple (remember that an assembler is, effectively, a IO filter -- read text, output binary). Without much effort I created a cross-compiler using LCC that uses NASM as it's backend. Porting NASM to my OS would now effectively involve recompiling nasm with my LCC cross-compiler.

yonami wrote: Nope. I am writing module to generate asm code for bootloaders. This is different thing than compiling an applications.
Compiler must generate code for first 512 bytes, and that part must load extended bootloader part. Then I give you (as a programmer) i/o functions and objects to handle fat*, reiserfs, etc. files. You must write kernel loading binary only. And then you can write kernel sources using the same and more libraries. But you must know ASM too if you want to write low level parts of your code.
Ahh, okay. I think I see where you're going with this. Sounds interesting.
yonami wrote: The most important thing is OPTIMALIZATION. And here is a reason why I want to write some modules for different binary formats assignments. "Boot" for bootloaders (simble module), "Kernel" for kernels, etc. OPTIMALIZATION exactly is a reason why I do that.
Right. You should still be able to do this using a prebuilt assembler such as nasm.
yonami wrote: Give me some time - I must finish the most basics first, and then you see my publication :-)
Sounds good! :)

--Jeff
yonami
Posts: 20
Joined: Tue Mar 07, 2006 12:00 am

Post by yonami »

Under construction yet :twisted:
Post Reply