Languages: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Combuster (talk | contribs)
Strip some embryo propaganda and put back the warnings where they belong.
Line 7: Line 7:
== Warning ==
== Warning ==


All languages can be used for low-level system programming, but many of them have no suitable low-level development tools available and require specific runtime support, where C does not. Also, the vast majority of OS related resources (like tutorials, and how-to examples, including this Wiki except where noted otherwise) assume C as the primary development language, so an OS developer should at least be able to read C code.
Not all languages are suited for low-level system programming, have no suitable low-level development tools available, or require specific runtime support, a problem C does not suffer from. Also, the vast majority of OS related resources (like tutorials, and how-to examples, including this Wiki except where noted otherwise) assume C as the primary development language, so an OS developer should at least be able to read C code.


Using a language other than C entails a good deal of extra effort. But there are [[Alta Lang |some developers]] who are willing to put in that effort in order to suit the development of their OSes to their ways of thinking (for example: [https://en.wikipedia.org/wiki/Programming_paradigm programming paradigms]).
Using a language other than C entails a good deal of extra effort. But there are [[Alta Lang |some developers]] who are willing to put in that effort in order to suit the development of their OSes to their ways of thinking (for example: [https://en.wikipedia.org/wiki/Programming_paradigm programming paradigms]).


On the other hand, there is a common belief that any attempt to write an OS in interpreted languages like Perl or Java is unlikely to succeed. There are research projects about it, of course, but nothing that has completely changed the way we write kernels so far. And trying to write it in HTML, PHP or Javascript would just be proof that you have much to learn, as the majority of OS developers see it.
On the other hand, attempting to write an OS in interpreted or bytecode languages like Perl or Java is prohibitively challenging, and therefore less likely to lead to a success story. There are research projects about it, of course, but nothing that has completely changed the way we write kernels so far. And trying to write it in HTML would just be proof that you have much to learn.


So, you're warned. And now you should make a choice, hopefully, the informed choice.
So, you're warned. And now you should make a choice, hopefully, the informed choice.
Line 17: Line 17:
== Can I use language XYZ? ==
== Can I use language XYZ? ==


; If you'd like to know if your favourite language is suited for OSDeving, just consider the most important principle - there should be a way of doing low level things in your language. But it doesn't mean the language itself must have low level support. All that is required for a code to be executed is the actual code in the form a processor can understand, so if your language can produce a byte array with machine code then it is possible to use the language for OS development. However, such generic way of doing things is a bit boring and may be it is still possible to find some readily available tools, suitable for your language.
; If you'd like to know if your favourite language is suited for OSDeving, just consider the most important principle - there should be a way of doing low level things in your language.


Also before you start it worth to answer the following questions :
Also before you start it worth to answer the following questions :
Line 26: Line 26:
* If XYZ fits the other points and is an interpreted language, can you invoke code coming from raw data bytes with XYZ, i.e. jump at a specific address and continue execution there (this will be mandatory for loading and running programs)?
* If XYZ fits the other points and is an interpreted language, can you invoke code coming from raw data bytes with XYZ, i.e. jump at a specific address and continue execution there (this will be mandatory for loading and running programs)?


If any of those question turns out to "whoops, no, I cannot do that with language XYZ", then chances are that XYZ will be of no help for OS development if you aren't ready to create appropriate tools yourself. But also it is possible to complement your project with other languages and stubs to function.
If any of those question turns out to "whoops, no, I cannot do that with language XYZ", then chances are that XYZ will be of no help for OS development. This particular problem has often been circumvented by modifying the language and writing writing new compilers.


== Can't I write a compiler for XYZ? ==
== Can't I write a compiler for XYZ? ==