Languages: Difference between revisions

Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content deleted Content added
Changed the "===" to "==" for all of the sections.
Line 4: Line 4:




=== History ===
== History ==


Early operating systems were written entirely in the [[Assembly]] language dialect of their respective CPU. In modern OSes there are still parts that can only be done in [[Assembly]]. Many high-level languages have been used for OS development in the past, including [[C]], Lisp, FORTH, [[C PlusPlus|C++]], Modula-2, Ada, Bliss, and PL/1. In many languages other than [[C]] a fair amount of [[Assembly]] and [[C]] development is required in order to provide the appropriate runtime environment supporting the language's abstractions.
Early operating systems were written entirely in the [[Assembly]] language dialect of their respective CPU. In modern OSes there are still parts that can only be done in [[Assembly]]. Many high-level languages have been used for OS development in the past, including [[C]], Lisp, FORTH, [[C PlusPlus|C++]], Modula-2, Ada, Bliss, and PL/1. In many languages other than [[C]] a fair amount of [[Assembly]] and [[C]] development is required in order to provide the appropriate runtime environment supporting the language's abstractions.


=== Warning ===
== Warning ==


Not all languages are suitable for low-level system programming, or have suitable low-level development tools available for them. Even those which are suitable often require specific runtime support, where C does not. Also, the vast majority of OS related resources (like tutorials, and how-to examples, including this FAQ 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 suitable for low-level system programming, or have suitable low-level development tools available for them. Even those which are suitable often require specific runtime support, where C does not. Also, the vast majority of OS related resources (like tutorials, and how-to examples, including this FAQ except where noted otherwise) assume C as the primary development language, so an OS developer should at least be able to read C code.
Line 16: Line 16:
On the other hand, trying 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, Javascript or .Net would just be proof that you have much to learn...
On the other hand, trying 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, Javascript or .Net would just be proof that you have much to learn...


=== 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 following questions :
; If you'd like to know if your favourite language is suited for OSDeving, just consider the following questions :
Line 27: Line 27:
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 - or will have to be mixed 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 - or will have to be mixed with other languages and stubs to function.


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


The only thing more complex than writing a compiler is writing an operating system. As you are already planning to do the latter, deciding to do the former also is like finding new ways to forge metals in order to build a better car. The canonical starting point is the "dragon book" ("Compilers - Principles, Techniques, and Tools" located on the [[Books]] page).
The only thing more complex than writing a compiler is writing an operating system. As you are already planning to do the latter, deciding to do the former also is like finding new ways to forge metals in order to build a better car. The canonical starting point is the "dragon book" ("Compilers - Principles, Techniques, and Tools" located on the [[Books]] page).


=== But I heard of an OS written in language ABC, isn't it interpreted? ===
== But I heard of an OS written in language ABC, isn't it interpreted? ==


You may from time to time hear of operating systems written in languages which are usually interpreted, or which used an interpreter of some sort: JavaOS, Generra (the Symbolics Lisp Machine OS), Smalltalk-80, USCD Pascal, the various FORTH systems, etc. Most of these fall into one of three categories :
You may from time to time hear of operating systems written in languages which are usually interpreted, or which used an interpreter of some sort: JavaOS, Generra (the Symbolics Lisp Machine OS), Smalltalk-80, USCD Pascal, the various FORTH systems, etc. Most of these fall into one of three categories :