Page 1 of 2

create a programming language for my own OS

Posted: Mon Apr 06, 2009 10:59 pm
by redoktober
okay, i know i'm being darn noobish by asking this.
but i have no choice!

anyway, i'm falling in love with python, and it's .net implementation, ironpython.
now, if i plan to write my own os, it would be a nice idea to have a built-in language for general programming. and maybe some scripting for automation as well.

now, if i wish to create a python-like lingo for my os, how on earth do i go about it??

please, somebody help!

thanks a ton!!
:D

Re: create a programming language for my own OS

Posted: Mon Apr 06, 2009 11:32 pm
by pcmattman
Hi,
now, if i wish to create a python-like lingo for my os, how on earth do i go about it??
Why not just port Python when your OS is ready?
now, if i plan to write my own os, it would be a nice idea to have a built-in language for general programming. and maybe some scripting for automation as well.
If you port Python you get both! If you had the will you could even make the Python interpreter your OS shell :)

--

Ok, seriously now...

If you were to write a Python-like language you would need to go about writing an interpreter. There's a lot of documentation about compiler writing on the internet - your interpreter is a lot like a compiler except it doesn't generate assembly (or machine code) but rather performs actions as they're read in the script. If you do it well enough your modules can be like Python's - ie, mostly written in Python (with shared objects at the lowest level).

I also strongly suggest you try writing a small BASIC interpreter or something before you take on something as big as a Python-style language.

Hope this helps a little!

Re: create a programming language for my own OS

Posted: Tue Apr 07, 2009 7:59 am
by redoktober
gee, man, that sounds cool!
if i could just port python, then i won't have to create my own version - that means i won't create a mess of the elegant python syntax!
and if i could make the python interpreter my os shell....even better!

YAY!

thanks a lot, mate!
i'm a lot less stressed out now!
8)

Re: create a programming language for my own OS

Posted: Tue Apr 07, 2009 2:03 pm
by Dex
Remember a interpreter in it very basic form, is like a CLI, but instead of you writing command in by hand ( eg:typing: Help <enter> ), it is read from a file.

Re: create a programming language for my own OS

Posted: Tue Apr 07, 2009 2:49 pm
by skyking
redoktober wrote:gee, man, that sounds cool!
if i could just port python, then i won't have to create my own version - that means i won't create a mess of the elegant python syntax!
and if i could make the python interpreter my os shell....even better!
The "official" implementation of python is quite straight forward to port. When stripped down to it's minimum there's just little OS-dependent functionality left and most of the rest can be eliminated without too much harm.

Re: create a programming language for my own OS

Posted: Tue Apr 07, 2009 8:55 pm
by DeletedAccount
Hi,
This is what I am trying to do , (a) Build a Lex clone (b) Build yacc clone (c) Write an icode to x86/java byte code / il convertor (d) Build another compiler using (a) , (b) , (c) . Write an os with (d ) . I know its going to take a loooooooooooooong time . I know that its worth the effort . I know all the algorithms and theory quite well . I would suggest you to read the dragon book , I have read it and many other books . If you have any problems with any of the algorithms/ theory feel free to post it in the forums or pm me . But I am quite busy , may not really reply on time . However let me , try to find some links for that can be useful , but a later post.

Regards
Shrek

Re: create a programming language for my own OS

Posted: Tue Apr 07, 2009 10:41 pm
by redoktober
sure, man!
thanks a lot!
i also found ironpython, and it's cool as well!
awesome!
yeah, there are some differences between ironpython and cpython, but i'll iron them out!

Re: create a programming language for my own OS

Posted: Wed Apr 08, 2009 1:09 am
by Love4Boobies
I have also been working on compilers for some time now. Just like Shrek, I plan to use that compiler in operating system development. I also recommend the Dragon Book (2nd ed.) but don't stop there. If you want to have something good, that book will only show you what areas you need to do research in (clearly the same applies to osdev'ing). Unfortunately, I seem to find that research papers on compilers are harder to find than on operating systems.

Re: create a programming language for my own OS

Posted: Thu Apr 16, 2009 4:58 am
by jal
redoktober wrote:now, if i wish to create a python-like lingo for my os, how on earth do i go about it??
See here: http://wiki.osdev.org/Porting_Python


JAL

Re: create a programming language for my own OS

Posted: Mon Apr 20, 2009 2:17 am
by redoktober
thanks a zillion, guys!

8)

Re: create a programming language for my own OS

Posted: Wed May 06, 2009 6:32 pm
by kubeos
hmmm... you guys gave me an idea for some shell scripting. A basic interpreter. There's quite a few small ones out there that would be extremely easy to port. Thanks guys, I was trying to figure out what I wanted to do for an install script. :o

Re: create a programming language for my own OS

Posted: Mon May 11, 2009 6:28 pm
by Brendan
Hi,
kubeos wrote:hmmm... you guys gave me an idea for some shell scripting. A basic interpreter. There's quite a few small ones out there that would be extremely easy to port. Thanks guys, I was trying to figure out what I wanted to do for an install script. :o
Just a quick note...

This probably applies to most languages; but the good thing about BASIC is that it's easy to interpret and easy to compile, and can be used for small/simple shell scripts, large/complex shell scripts, or full applications. The nice thing here is the OS could automatically compile large shell scripts that are frequently used to improve performance, and programmers would be able to run full applications with the interpreter (mostly for much more powerful interactive debugging).

To be honest, this sort of simplicity (one language for everything) is one of the things I really miss from old computers (e.g. the Commodore 64), and it's something severely lacking from OSs like Linux (where there's about 50 different languages being used, just in case the first 49 languages didn't annoy you enough ;) ).


Cheers,

Brendan

Re: create a programming language for my own OS

Posted: Tue May 12, 2009 4:41 am
by Solar
Brendan wrote:To be honest, this sort of simplicity (one language for everything) is one of the things I really miss from old computers (e.g. the Commodore 64), and it's something severely lacking from OSs like Linux (where there's about 50 different languages being used, just in case the first 49 languages didn't annoy you enough ;) ).
Full ACK. Early machines used to come with one "real" programming language (for applications), and one "easy" one (for first steps or one-shot solutions).

C64: ASM, BASIC 2.0.

AmigaOS: C, ARexx.

Early Linux: C, Perl.

Today, no matter what language you chose, you'll get flak from the other camps for your poor choice...

Re: create a programming language for my own OS

Posted: Tue May 12, 2009 6:07 am
by JackScott
I have a question to pose for the great Solar, and of course others. Is there a language that can perform both these functions, or are they mutually exclusive? Does there exist (in theory), out there in the ether, a programming language that does do everything?

I hear Python touted a lot in the mainstream parts of the programming world as the all-singing, all-dancing programming language that's so useful that you can start off writing a 10-line script in it and expanding that into a full-featured application is effortless. Having used Python a fair bit myself, I can tell you that it's definitely good for the small scripts, but falls down in the latter area (especially compared to languages like C++ and even Java). But I wouldn't write a 10-line script in C++ (in fact, I don't think it's even possible). Paul Graham likes Lisp, and I do too, but I wouldn't write a full application in that either.

I'll jump on the bandwagon as well as another who is interested in compiler and interpreter development. I think those two go hand in hand with operating system design. Not development, because if you skip the design phase and just write a UNIX clone, you default to C anyway. But if you put a lot of thought into an operating system's design, you really would be failing if you didn't also consider it's primary languages (even if you do end up deciding C is the best).

Re: create a programming language for my own OS

Posted: Tue May 12, 2009 7:09 am
by DeletedAccount
hi,
I would point you to
(a) http://www.amazon.co.uk/Introduction-Au ... 0201441241
(b) http://en.wikipedia.org/wiki/Turing_machine
JackScott wrote:I have a question to pose for the great Solar, and of course others. Is there a language that can perform both these functions, or are they mutually exclusive? Does there exist (in theory), out there in the ether, a programming language that does do everything?
In theory any programming language that can simulate a turing machine can solve any 'solvable' computational problem . You can take a look at book which i provided , it is quite famous and should be available in your college library . If you face any difficulty in solving any of the proof's in that text , please feel free to post it in the forums . Although I do not remember everything exactly , I will definitely try to help.


Regards
Shrek