OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Dec 12, 2017 4:21 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: How can I add support for other languages in my OS?
PostPosted: Wed Nov 01, 2017 8:03 pm 
Offline

Joined: Wed Nov 01, 2017 7:41 pm
Posts: 19
Can I add for example Python support for my OS? Or any kind of language, like Java, Ruby, PHP etc?

Sorry if this questions have already answered but I really don't find any material about this. And sorry for mah bad English, i'm brazilian.

_________________
OS Development is awesome!

|AetherOS Project|


Top
 Profile  
 
 Post subject: Re: How can I add support for other languages in my OS?
PostPosted: Wed Nov 01, 2017 9:17 pm 
Offline

Joined: Fri Jun 02, 2017 3:01 pm
Posts: 7
In user mode or in kernel mode?

_________________
Developing CHicago Operating System.


Top
 Profile  
 
 Post subject: Re: How can I add support for other languages in my OS?
PostPosted: Thu Nov 02, 2017 3:21 am 
Offline
Member
Member

Joined: Tue May 13, 2014 3:02 am
Posts: 216
Location: Private, UK
First, have a comprehensive enough userspace that it makes sense... You'll need a C standard library at the very least, and likely a bunch of other support libraries.

Second, port the language's compiler(*)/interpreter/runtime to your OS. Depending on how comprehensive your userspace is, how similar it is to other OS's that the language supports and how much of a priority the original developers put on portability this can range from "trivial" to "several years of work".

The wiki has an article on Porting Python, which should at least cover the basic concepts (although the exact steps will be different) for porting similar software.

If you're talking about using other languages in your kernel, that's a bit different. Some highly-portable languages (such as those designed to work on "embedded" systems) like Lua can be adapted for kernel use fairly easily, but anything with a substantial runtime is likely to be quite difficult...

(*) For compiled languages, you may not have to port the compiler to your OS itself, but just re-target it to act as a cross-compiler running on another OS (i.e. your development environment).

_________________
Image


Top
 Profile  
 
 Post subject: Re: How can I add support for other languages in my OS?
PostPosted: Sat Nov 04, 2017 3:36 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1145
mallard wrote:
For compiled languages, you may not have to port the compiler to your OS itself, but just re-target it to act as a cross-compiler running on another OS (i.e. your development environment).
If you do that then of course you'll only be able to run the compiled binaries on your OS, you'll still need another system to compile the source code that's been written in your chosen language.

Also in addition to porting the interpreter/runtime to your OS you'll also need to write a binding between your OS's API and your chosen language (unless the interpreter/runtime provides a standard API, in which case you'll need to implement the standard API using your OS's API as part of the porting step).

It's best to not think of this as "adding support for a language to your OS". OSes do not "support" languages. For compiled languages you're making the compiler support your OS, not the other way around. For interpreted languages you're porting the interpreter to run on your OS. Your OS "supports" any language for which there is a compiler that can compile for it or an interpreter that can run on it. Language "support" is not built into an OS but is dependant on the compilers/interpreters rather than the OS itself.

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group