PearOs (you can follow my work)

Programming, for all ages and all languages.
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

PearOs (you can follow my work)

Post by PearOs »

Hello Osdev!

I have been working on my operating system for around four years now. However, recently I have began a different approach. I am currently writing a compiler to support the C# language so that I may port the compiler to my operating system (Sounds a little crazy, and actually it is!).
Anyways, you guys are welcome to follow my work and check out my code:
http://pearos.codeplex.com

Just thought I would share in case someone was interested!

Thanks,

Matt
Last edited by PearOs on Sun Jul 20, 2014 12:38 pm, edited 1 time in total.
alexfru
Member
Member
Posts: 1111
Joined: Tue Mar 04, 2014 5:27 am

Re: PearOs (you can follow my work)

Post by alexfru »

PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: PearOs (you can follow my work)

Post by PearOs »

Oh thank you for letting me know, I didn't notice that.

Thanks,
Matt
Darkstar
Posts: 5
Joined: Mon Jul 21, 2014 12:46 am

Re: PearOs (you can follow my work)

Post by Darkstar »

PearOs wrote:Hello Osdev!

I have been working on my operating system for around four years now. However, recently I have began a different approach. I am currently writing a compiler to support the C# language so that I may port the compiler to my operating system (Sounds a little crazy, and actually it is!).
Anyways, you guys are welcome to follow my work and check out my code:
http://pearos.codeplex.com

Just thought I would share in case someone was interested!

Thanks,

Matt
Hi Civilwarrock.

I am curious why you are rolling your own compiler for this? Why reinvent the wheel when there are several languages out there suited for OS Development. Even though I wouldn't recommend C# for OS development, there are native C# compilers out there (See tysila). No offense, but you will not be able to reach the level of optimization by pre-existing compilers such as gcc. Also I think you should do a bit more research into compiler development, as it appears you are lacking an understanding of several fundamental concepts (Abstract syntax tree, lexical analysis, ect). Also there are several classes defined your compiler that are unnecessary and redundant (Examples: BracketCounter.cs, DirectoryHelper.cs, ect). You might want to research what a recursive decent parser is too as it can help you reduce the amount of poorly written code such as your CallParser. Also you should construct some sort of symbol table.

Darkstar
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: PearOs (you can follow my work)

Post by PearOs »

Darkstar wrote:
PearOs wrote:Hello Osdev!

I have been working on my operating system for around four years now. However, recently I have began a different approach. I am currently writing a compiler to support the C# language so that I may port the compiler to my operating system (Sounds a little crazy, and actually it is!).
Anyways, you guys are welcome to follow my work and check out my code:
http://pearos.codeplex.com

Just thought I would share in case someone was interested!

Thanks,

Matt
Hi Civilwarrock.

I am curious why you are rolling your own compiler for this? Why reinvent the wheel when there are several languages out there suited for OS Development. Even though I wouldn't recommend C# for OS development, there are native C# compilers out there (See tysila). No offense, but you will not be able to reach the level of optimization by pre-existing compilers such as gcc. Also I think you should do a bit more research into compiler development, as it appears you are lacking an understanding of several fundamental concepts (Abstract syntax tree, lexical analysis, ect). Also there are several classes defined your compiler that are unnecessary and redundant (Examples: BracketCounter.cs, DirectoryHelper.cs, ect). You might want to research what a recursive decent parser is too as it can help you reduce the amount of poorly written code such as your CallParser. Also you should construct some sort of symbol table.

Darkstar
I am rolling my own compiler because it's quite simple. I use C# for my os development. Secondly I have my own structures as well as design as to how the inner workings of my operating system work, therefore something like tysila is somewhat out of my reach. I'm sure I could use something like it, but I'm not trying to reach the optimization of something like gcc. Actually I am lacking those features quite on purpose, just because those concepts exists does not mean its set in stone and that I have to use them. Actually BracketCounter.cs is not redundant, it's quite useful really, and DirectoryHelper yeah that's just for my convenience.

I actually like my CallParser, the current version is fast and simple, so I appreciate your opinion. However, I will reinvent the wheel for many many reasons, more than I am willing to give you. Part of my reason for writing this compiler is for the challenge and to give me something to do, I'm sure you can understand that. :wink:

Oh and if your looking for a lexical analyzer take a look at Tools.IO.TokenScanner :wink: Hahaha
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: PearOs (you can follow my work)

Post by zhiayang »

Interesting work there, PearOS was in my eyes one of the more advanced projects over here (and in C# too!)
I understand PearOS 6 is your current version (and open source), but is there any chance you'll open source the previous versions as well?

Great work anyway.
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: PearOs (you can follow my work)

Post by PearOs »

requimrar wrote:Interesting work there, PearOS was in my eyes one of the more advanced projects over here (and in C# too!)
I understand PearOS 6 is your current version (and open source), but is there any chance you'll open source the previous versions as well?

Great work anyway.
Why thank you, I don't know about the more advanced however, I will be redoing the old source into the new version.. so I would wait till that happens, which I estimate to be within a month or so. The old code was great but ill probably keep it closed source for now at least. My goal with this version is to make my work even better and allow a lot more possibilities, there was some things that tied me down a little in PearOs 5 that really needed to be tackled.

Thanks,

Matt
embryo

Re: PearOs (you can follow my work)

Post by embryo »

PearOs wrote:I have been working on my operating system for around four years now. However, recently I have began a different approach. I am currently writing a compiler to support the C# language so that I may port the compiler to my operating system
It's interesting, but I still in doubts - have you wrote the OS in C#? Or in C and now trying to add C# compiler to it? If it was the C#, then it is really interesting how have you implemented low level things that traditionally are implemented using assembly?
User avatar
zhiayang
Member
Member
Posts: 368
Joined: Tue Dec 27, 2011 7:57 am
Libera.chat IRC: zhiayang

Re: PearOs (you can follow my work)

Post by zhiayang »

embryo wrote:It's interesting, but I still in doubts - have you wrote the OS in C#? Or in C and now trying to add C# compiler to it? If it was the C#, then it is really interesting how have you implemented low level things that traditionally are implemented using assembly?
From what I can tell, most or all of his OS is in C#, like how your OS is in Java.
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: PearOs (you can follow my work)

Post by PearOs »

embryo wrote:
PearOs wrote:I have been working on my operating system for around four years now. However, recently I have began a different approach. I am currently writing a compiler to support the C# language so that I may port the compiler to my operating system
It's interesting, but I still in doubts - have you wrote the OS in C#? Or in C and now trying to add C# compiler to it? If it was the C#, then it is really interesting how have you implemented low level things that traditionally are implemented using assembly?
The operating system, and kernel are in C#. There is a backend written in Assembly that's a small kernel per say, it's a framework that supports the C# language, and allows me access to low level features. For example there was a module called "RTBB" which stands for "Real Time Bitmap Blitter" and was written entirely in Assembly and that was because I was able to make optimizations that were just really amazing. I would say 95% of my Operating system is written in C#, there's only a small amount that couldn't be, and really shouldn't be.

However.. PearOs 6 will be written in DarkSharp which is basically C# with very little rules. It will allow a lot of faster code production and let me write code that is meant for operating systems, because like if I define a string in C#, it's just a pointer to a memory location where the string data is located, but if I want to convert the string to a int to pass it to a void, it's a little annoying but can be done, where as in DarkSharp I will just be able to use it like it's a number and it won't argue with it. Which is highly bad for programmers who are new, however for me that's what I need. So PearOs will become custom C# and not native C# anymore. Which I think is best.

Thanks,

Matt
embryo

Re: PearOs (you can follow my work)

Post by embryo »

PearOs wrote:The operating system, and kernel are in C#. There is a backend written in Assembly that's a small kernel per say, it's a framework that supports the C# language, and allows me access to low level features.
Thanks for clarification. But as far as I know C# and other MS-languages are compiled in something like bytecode and then the bytecodes are executed using .Net runtime, which in turn has JIT compiler to optimize the bytecode to the lowest possible level. If I see it correct and you still have no readily available C# compiler then how it is possible to run C# code without .Net runtime?
PearOs wrote:PearOs 6 will be written in DarkSharp which is basically C# with very little rules.
The next will go your personal language :)
FallenAvatar
Member
Member
Posts: 283
Joined: Mon Jan 03, 2011 6:58 pm

Re: PearOs (you can follow my work)

Post by FallenAvatar »

embryo wrote:
PearOs wrote:...
Thanks for clarification. But as far as I know C# and other MS-languages are compiled in something like bytecode and then the bytecodes are executed using .Net runtime, which in turn has JIT compiler to optimize the bytecode to the lowest possible level. If I see it correct and you still have no readily available C# compiler then how it is possible to run C# code without .Net runtime?
embryo,

Maybe you should check out the repo you are interested in. He has a whole project dedicated to compiling...

HINT: Look at Source Code -> Source -> Compilers

- Monk
PearOs
Member
Member
Posts: 194
Joined: Mon Apr 08, 2013 3:03 pm
Location: Usually at my keyboard!

Re: PearOs (you can follow my work)

Post by PearOs »

embryo wrote:
PearOs wrote:The operating system, and kernel are in C#. There is a backend written in Assembly that's a small kernel per say, it's a framework that supports the C# language, and allows me access to low level features.
Thanks for clarification. But as far as I know C# and other MS-languages are compiled in something like bytecode and then the bytecodes are executed using .Net runtime, which in turn has JIT compiler to optimize the bytecode to the lowest possible level. If I see it correct and you still have no readily available C# compiler then how it is possible to run C# code without .Net runtime?
PearOs wrote:PearOs 6 will be written in DarkSharp which is basically C# with very little rules.
The next will go your personal language :)
Alright ill explain this.

PearOs 5 was written in C#, I wrote a .Net Framework clone in Assembly, although most of the clone was written in the Kernel. So both the Kernel and Operating System relied on that framework versus the original .Net Framework. Second, I wrote a compiler that would take the IL Output from the dll files and then convert that into Assembly. That's how I made it work.

Now, PearOs 6's compiler is currently outputting a language like CIL but its called XIL, however I may just have it output CIL because then it would be compatible with Windows, and then I could just take Windows programs and write a API and then have the ability to convert Windows programs to Pear programs, which I have done before, but it would be easier if DarkSharp's output was CIL because I'd already have a CIL compiler working.

Anyways,
so a few design decisions I need to decide but that's what I did. As stated above, I have a whole folder dedicated to compilers for the reason I will be writing a few for this project I have a feeling.

- Matt
embryo

Re: PearOs (you can follow my work)

Post by embryo »

tjmonk15 wrote:Maybe you should check out the repo you are interested in. He has a whole project dedicated to compiling...

HINT: Look at Source Code -> Source -> Compilers
Of course, checking the source is an option, but asking the author about his vision is a much better variant, because we can see some motivation behind the code.

And one more point - asking is much easier than understanding a general concept using raw and undocumented sources. Why not to use simple method instead of hard one?
embryo

Re: PearOs (you can follow my work)

Post by embryo »

PearOs wrote:PearOs 5 was written in C#, I wrote a .Net Framework clone in Assembly, although most of the clone was written in the Kernel. So both the Kernel and Operating System relied on that framework versus the original .Net Framework. Second, I wrote a compiler that would take the IL Output from the dll files and then convert that into Assembly. That's how I made it work.
As it seems from the source code the compiler is not workable yet. Under "Compilers.DarkSharp.DarkSharp.IL" branch of the repository I can see Add.cs with the following code:

Code: Select all

namespace DarkSharp.IL.Opcodes
{
    public class Add : Opcode
    {
    }
}
There are 6 more files like this. And that's all opcodes I can see.

Also I can not see anything under the "Kernel" and "OS" branches. It means there is no OS (at least I can not see it). The same can be said about "Kernel" and "OS" branches under the "Docs" root. So, there is no OS and no documentation, but there is something that the author calls "the compiler". Not very close to an OS project, as I can see it.
PearOs wrote:Now, PearOs 6's compiler is currently outputting a language like CIL but its called XIL, however I may just have it output CIL because then it would be compatible with Windows, and then I could just take Windows programs and write a API and then have the ability to convert Windows programs to Pear programs
It's great that you can say "I could just take Windows programs and write a API and then...", but rewriting Windows API is a task much more time consuming, than a few dozens of C# files you already have.

Unfortunately, I can not see a viable subject to discuss, unless the subject is just some expectations.
Post Reply