create a programming language for my own OS
-
- Member
- Posts: 109
- Joined: Thu Feb 26, 2009 12:58 am
- Location: Gurgaon/New Delhi, India
- Contact:
create a programming language for my own OS
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!!
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!!
"Do you program in Assembly?" she asked. "NOP," he said.
"Intel Inside" is a Government Warning required by Law.
"Intel Inside" is a Government Warning required by Law.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Re: create a programming language for my own OS
Hi,
--
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!
Why not just port Python when your OS is ready?now, if i wish to create a python-like lingo for my os, how on earth do i go about it??
If you port Python you get both! If you had the will you could even make the Python interpreter your OS shellnow, 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.
--
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!
-
- Member
- Posts: 109
- Joined: Thu Feb 26, 2009 12:58 am
- Location: Gurgaon/New Delhi, India
- Contact:
Re: create a programming language for my own OS
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!
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!
"Do you program in Assembly?" she asked. "NOP," he said.
"Intel Inside" is a Government Warning required by Law.
"Intel Inside" is a Government Warning required by Law.
Re: create a programming language for my own OS
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
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.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!
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: create a programming language for my own OS
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
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
-
- Member
- Posts: 109
- Joined: Thu Feb 26, 2009 12:58 am
- Location: Gurgaon/New Delhi, India
- Contact:
Re: create a programming language for my own OS
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!
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!
"Do you program in Assembly?" she asked. "NOP," he said.
"Intel Inside" is a Government Warning required by Law.
"Intel Inside" is a Government Warning required by Law.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: create a programming language for my own OS
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.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: create a programming language for my own OS
See here: http://wiki.osdev.org/Porting_Pythonredoktober wrote:now, if i wish to create a python-like lingo for my os, how on earth do i go about it??
JAL
-
- Member
- Posts: 109
- Joined: Thu Feb 26, 2009 12:58 am
- Location: Gurgaon/New Delhi, India
- Contact:
Re: create a programming language for my own OS
thanks a zillion, guys!
"Do you program in Assembly?" she asked. "NOP," he said.
"Intel Inside" is a Government Warning required by Law.
"Intel Inside" is a Government Warning required by Law.
Re: create a programming language for my own OS
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.
Re: create a programming language for my own OS
Hi,
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
Just a quick note...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.
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
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: create a programming language for my own OS
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).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 ).
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...
Every good solution is obvious once you've found it.
Re: create a programming language for my own OS
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).
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).
-
- Member
- Posts: 566
- Joined: Tue Jun 20, 2006 9:17 am
Re: create a programming language for my own OS
hi,
I would point you to
(a) http://www.amazon.co.uk/Introduction-Au ... 0201441241
(b) http://en.wikipedia.org/wiki/Turing_machine
Regards
Shrek
I would point you to
(a) http://www.amazon.co.uk/Introduction-Au ... 0201441241
(b) http://en.wikipedia.org/wiki/Turing_machine
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.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?
Regards
Shrek