Brendan wrote:Hi,
pikasoo wrote:Im just wondering wich language is the favorit and also if you are starting from scratch or from an existing base (open source os)
This has been a constant problem for me. My goal is to write a radically different OS in an entirely new language, with no compatibility with existing OSs, languages, file formats, tools, etc.
There are 2 ways to achieve this:
- write my own language/toolchain and then write the OS in that new language. In this case I'd need to write the toolchain twice (e.g. once as a set of tools for Linux that I can use to write the OS, then again as native tools for my OS).
- write the OS in an existing language, and then create a native toolchain for the OS. This ends up being worse as I'd need to write parts of the OS twice (e.g. once in an existing language so I can start developing the tool chain, and then a second time in the new language) and also write parts of the toolchain twice (once in assembly and again in a native language).
At the moment, my current plan is to write the least amount of OS code I need to start developing native tools, and do this initial code in assembly (NASM); then write native tools starting with an assembler and a "legacy text file to assembly source" file format converter.
I keep having second thoughts though. Every now and then I decide I should be doing the opposite and start writing tools (for Linux) in C.
Cheers,
Brendan
it's something i ponder as well, there is some hint toward this somewhere in the wiki with the language approach, i'd clearly like to implement a powerfull scripting language for application, why not using lua, something close to flash AS3 actually
i really liked the experience of AS3 with runtime defined object type, and it allow (and even force) asynchronous definition for everything, data loading, and pretty much everything is handled with load events
with the object/COM approach, there would be a way to make some premade little scripted object library to build application uppon , that are supposed to handle image and ressource loading asynchronously, application would then use them either based on mime-type with a generic loading function and runtime class definition to handle structure specific to the object loaded, or either the application would have to search manually for an object that can handle this mime type in the system and using the object methods to manipulate it
but at low level layer, the problem with PC is in the same time a good thing, is that there is no true hardware specification for what modern pc can be, and most of the function that modern computer offer are more defined by the os than by the hardware itself, modern computers would be pretty useless today without the several Go big os like linux and windows, and it already need a fair level of complexity to initialize correctly even the basic hardware, it need good ressource mannagement, handling of buses and drivers tree, and an efficient way to manage and process interupts manipulating data types to communicate with the device that are not that easy to handle, and it already require a robust language to handle basic things
at the moment i'm looking into AML and acpi and the kind of functionality it offer can be interesting for that purpose, as it is already an hardware standard that is well established on pc, and allow to find the whole hardware configuration of the machine, and it can be used also to provide an high level api to mannage all the pc hardware
but even from there, it still require lot of things to have a real software basis on which to build application, and to even handle all the hardware, either the scripting language would need to be also kernel oriented and being able to call kernel-like functions, like accessing io /port, managing interupt, and hardware level things, potentially being based on acpi, and then you would program even drivers and other things in scripting language
then with a COM-like approach to have system wide scripted object that can be instanciated or used in other higher level script, and having the whole system built up from scratch using self defined language, with a good support for asyncrhnous object oriented kind of programming, the basic parser for that kind of scripting language could be made simple and more function added on top of them with object definition
in the same time, i still prefer to handle lot of things in a c compatible manner, there are tons of compilers on every plateform that are well working, and i made my own ABI that convert from .so and .dll file for export functions, so i can easily manipulate modules as object with a c interface specific to each instance of the module loaded
i'd rather have a clean interface in C, with runtime object definition, to eventually build a script system uppon, rather than having to depend on whole tool chain that is os specific to develop it, as there are many tools to compile/debug/parse/edit C code, and the binary format compilers output are also well known and not so hard to work with
eventually i'd just make a linker to output a dynamically linked binary object in a specific format, eventually with a generic interface to probe the definitions of the module in a generic manner like with COM an IDL, embeded in binary dll at link time, that would be something that i'd like to do in the future, something that would work on exported symbol to build a class definition at link time, and a system to instanciate dynamic objects at runtime when the module in a binary file is probed/loaded
if you define the type you use in the base kernel C function in a way that is clean enough, you can mannage to make a script language that can manipulate them as well, even if you code some of the base module in C, you can bind the interface they expose after in an higher level scripted language