Hello everyone,
I am thinking of developing an operating system but there are some doubts that will not let me proceed. I am very grateful to everyone who can help. Here are the questions:
1) Is it possible to "install" a programming language? I love Java (remember that the goal is not to make the operating system in Java) and it would be great to be able to make APIs with Java syntax.
2) HTML, CSS, JS ... If I wanted to make a "Chrome", how could I use these languages.
Thanks.
Doubts about programming languages.
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Doubts about programming languages.
To use a programming language on your OS, you need a compiler and a runtime. Java typically compiles to bytecode and relies on a JVM to provide the runtime, so you could port an existing compiler and JVM to your OS, and then modify them to provide your Java APIs. (Or write your own Java compiler and runtime!)yByonic wrote:1) Is it possible to "install" a programming language? I love Java (remember that the goal is not to make the operating system in Java) and it would be great to be able to make APIs with Java syntax.
For comparison, many hobby projects provide support for C by porting a C compiler and C runtime library. Java sounds like a bit more of a challenge than C! (And if you choose to port a JVM, you might discover that it depends on a C runtime library anyway...)
Port Chromium.yByonic wrote:2) HTML, CSS, JS ... If I wanted to make a "Chrome", how could I use these languages.
Or write your own browser engine, but that's way beyond my area of expertise.
Re: Doubts about programming languages.
Developing a complete operating system (short: OS) is a huge task.yByonic wrote:Hello everyone,
I am thinking of developing an operating system but there are some doubts that will not let me proceed. I am very grateful to everyone who can help. Here are the questions:
1) Is it possible to "install" a programming language? I love Java (remember that the goal is not to make the operating system in Java) and it would be great to be able to make APIs with Java syntax.
2) HTML, CSS, JS ... If I wanted to make a "Chrome", how could I use these languages.
Thanks.
1.) Java syntax is very similar to C syntax when it comes to brackets etc. Of course Java is OOP and C is not. I think there are many programming languages with syntax like Java. AFAIK there still is not a freely available Java compiler, so you have to write a Java compiler yourself. Or write an OS which is compatible to an existing OS so you can install Java.
2.) If you want to make a browser you need an application programming language. The programming languages you mention are web development languages. You can't use them for making a browser.
Let me ask you: Why would it be fun for you to write an OS? And why do you want to write a "Chrome"? Because it depends on your goals and motivation whether OS development is the right thing for you.
Greetings
Peter
Re: Doubts about programming languages.
No, you can't install a programming language. What you can do, is to install a compiler and runtime for a specific language. Most compilers produce native executable code in which case the runtime is usually a library with standard functions; others produce machine independent bytecode where the runtime must include an interpreter and/or a bytecode-to-native code JIT compiler.yByonic wrote:Hello everyone,
I am thinking of developing an operating system but there are some doubts that will not let me proceed. I am very grateful to everyone who can help. Here are the questions:
1) Is it possible to "install" a programming language? I love Java (remember that the goal is not to make the operating system in Java) and it would be great to be able to make APIs with Java syntax.
Java source compiles to bytecode, so if you want to run it on your OS, then you'll have to write functionality enough to run a Java bytecode interpreter (also called Java Virtual Machine). Luckily to you, others have already done that, take a look at SanOS:
Which is exactly what you were asking.The kernel was developed as part of an experiment on investigating the feasibility of running java server applications without a traditional operating system only using a simple kernel.
First of all, HTML and CSS are not programming languages, neither is JavaScript. The first two are declarative languages, and the last being a scripting language, however with the invent of WASM JavaScript can be seen as a fully featured programming language.yByonic wrote:2) HTML, CSS, JS ... If I wanted to make a "Chrome", how could I use these languages.
As others have said, port Chromium or Firefox, that's the simplest (but not easy) way. For HTML+CSS, you could use some simple FOSS browser, like NetSurf or a FOSS HTML rendering library, like lexbor, both having a small codebase and relatively easy to port. But for Javascript, you're screwed, no viable and working alternative exists to mainstream browser's engines, which are huge, bloated, and insanely hard to port to a hobby OS.
Cheers,
bzt
Re: Doubts about programming languages.
Hello everyone,
Sorry for the delay.
@Octocontrabass, what compilers and JVMs are there for me to port or how can I make my own? Would that allow me to use the "java" command in CMD?
Would Chromium understand HTML, CSS and JavaScript?
@PeterX, I am determined to start this project, I am just collecting information and looking for answers to my questions so I can start in the best way
Thank you.
Sorry for the delay.
@Octocontrabass, what compilers and JVMs are there for me to port or how can I make my own? Would that allow me to use the "java" command in CMD?
Would Chromium understand HTML, CSS and JavaScript?
@PeterX, I am determined to start this project, I am just collecting information and looking for answers to my questions so I can start in the best way
Thank you.
Re: Doubts about programming languages.
Then you have already the most important qualification for OS dev: determination. Great! (This is important because it makes it possible for you to have high ambitions.)yByonic wrote:@PeterX, I am determined to start this project, I am just collecting information and looking for answers to my questions so I can start in the best way
You have several options from which you can choose:
1.) develop an OS and then your browser or your Java on it.
2.) Use an existing OS and develop Java on it.
3.) Explore Sanos mentioned by bzt. (I didn't know that project. It sounds cool.)
Similarly you have these options to develop a browser:
1.) Tinker with existing open source browsers.
2.) Use existing libraries and develop an browser ontop of them.
3.) Write one from scratch.
-
- Member
- Posts: 5513
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Doubts about programming languages.
If you want to port a Java compiler and runtime, the obvious choice is OpenJDK - it's the reference implementation for Java. It includes a compiler, JVM, and standard runtime libraries, and it's open-source so you can modify the platform-specific parts to run on your OS. Unfortunately, it's also a rather large project, so it'll be a lot of work.yByonic wrote:what compilers and JVMs are there for me to port or how can I make my own?
There are also compilers that can compile Java code to native machine code rather than JVM code; if you port one of those, you won't need a JVM (but you will still need the Java runtime libraries).
I'm not familiar with compiler development, so I can't really help you there. If you choose to write your own JVM, though, I suggest you look into emulator development. A lot of the techniques that go into emulating video game consoles apply pretty well to executing Java bytecode.
Sure, but you'll have to write your own CMD since Microsoft won't let you use theirs in your OS.yByonic wrote:Would that allow me to use the "java" command in CMD?
Yes, of course. Chromium is a complete web browser, and Chrome is just Chromium with a handful of extra features.yByonic wrote:Would Chromium understand HTML, CSS and JavaScript?
Re: Doubts about programming languages.
Thanks!
For all who see this and have more questions, feel free to continue.
For all who see this and have more questions, feel free to continue.
Re: Doubts about programming languages.
There are quickjs, duktape, serenityos libjs, etc...bzt wrote:for Javascript, you're screwed, no viable and working alternative exists to mainstream browser's engines, which are huge, bloated, and insanely hard to port to a hobby OS.