Re: Java as an alternative language in the wiki
Posted: Tue Nov 17, 2015 5:27 am
The problem with Java is - there's no native compiler for it written in Java. So, I need to start somewhere. And the obvious starting point is the assembly translator. Next, there should be Java compiler. And both should be familiar for a person who writes low level things in Java. It's true for every language.Brendan wrote:You're conflating "writing a C compiler" with "using a C compiler".
Next, as a starting point of the low level, the bootloader looks like the real root from which all branches can be grown. Now there's no Java compiler able to produce bootloader code from pure Java source (no assembly imitation). It means now it's still impossible to use Java without the assembly level. And as a result it is impossible to start using Java for low level without using some form of Java related assembly (or a smart compiler, which is still nonexistent). So, how to describe Java bare bone steps without describing the assembly approach applicable for the "pure Java" solution?
And if it's the contradictory question then I (and you and others) can leave some comments in the bare bones text. My comments are already there.
Have you noticed some kind of "chicken and egg" problem here? And I think the resolution of such problem can be found on the way of describing things from low level and up. And it means the first step (bare bone) is (can be) the assembly.Brendan wrote:It's entirely possible to use C differently. For example, you could write an assembler in C that uses "assembly source code" embedded directly in the assembler's own C (e.g. as data and/or macros and/or functions, not as inline assembly); so that when you execute the compiled C program it assembles the assembly source code that was embedded into it.
The syntax is defined by C. And everything else is still the C related stuff, even if it looks like assembly. The same is true for Java.Brendan wrote:but if someone did do this then the boot loader would be written in (an awkward/ugly dialect of) assembly and the boot loader wouldn't be written in C at all.
Then there's another language and it's environment. In case of Java assembly there's no alien environment and there's just some similarity between the example and manual syntax and the actual Java code. It's similarity. It's not assembly. But I know, there could be different opinions.Brendan wrote:In the same way; you could write an assembler in Java that gets the assembly source code from separate file/s (and then write a boot loader in assembly);
In fact it's Java library, which imitates assembly syntax and produces machine code in raw binary form. What if there were things like "moveRegToReg(getFreeReg(),getFreeReg());" in a compiler code? Would it be the bootloader written in assembly after the program (the compiler) will be executed?Brendan wrote:or you could write an assembler in Java where the assembly source code is embedded directly into the assembler itself (and then write a boot loader in assembly).
Basically, it's not as simple.Brendan wrote:Basically; you're writing an assembler, and then writing a boot loader in assembly. You're not writing a boot loader in Java.
And a bit of english:
Can you clear the usage of the assembler and assembly words in different contexts? Is assembler a program? Is assembly the language? Or?Brendan wrote:or you could write an assembler in Java where the assembly source code...