bluemoon wrote:Is there any reason you need to invent a programming language, an executable format, a new runtime linking method, implement a set of programming framework, all at once and the end product is limited to run on specially designed OS?
I may not do that unless a gun pointed to my head.
Let me defend the OP, I did it this way, for the following reasons:
1. language: my language is a superset of C, because I didn't like the way Objective-C and C++ expands it. What's more, I could implement more paradigms, my language also supports aspect orientation. C is a good language for kernels, but a headache for userspace apps.
2. executable format: ELF is a mess, overenginered, and does not support multiple dispatch without ugly hacks. My object format contains method arguments as well, and it's easy to use like the tpu-s back in the old dos pascal days. No headers and such necessary. If you have the library, you're ready to use it right away.
3. runtime linking: I've support for it at language level, so there should be no incompatible implementations like in C. My runtime linker includes a JIT compiler that translates the bytecode to native code.
4. limited to run on specially designed OS: not true, my compiler runs on MacOSX and Linux, and with cygwin under windoze too. I haven't implement a runtime environment on these yet, but it's part of the plan (low priority).
"I may not do that unless a gun pointed to my head."
If you think so, why do you start to write an OS in the first place? What's so different to write an OS from scratch and to design a language from scratch?
For the OP: your goals are similar to mine, but I can tell you, this is the hardest way to do it. But, if you want to learn, and have maximum control over your machine, this is the path you're looking for.
VFS image is not the best choice, I have so called chunks in my object files (each prefixed by a magic and a size, 8 bytes overhead), but does the same as yours:
data.o equivalent of constants and initialized data chunks
func.o equivalent of linkage chunk
code.o is identical to my code chunk.
I also have a property definition chunk, that describes the valid keys and values of configuration files, something that ELF and PE lack. This way I can have one userspace configuration editor (call it a form generator and validator) that fits for all, and a simple, easy to use api in standard library to read configurations (let's say similar to getopt or getenv. I know they do not use configuration files, but the point is they serve information on how to run).