Question

Does a bytecode compiler first convert the source code into VM assembly language which is then converted to VM bytecode?

e.g

[Source Code] --> { [VM Bytecode Compiler (lex, parse into AST)] --> [AST to VM assembly] } --> [VM Assembler] --> [VM Bytecode]

Was it helpful?

Solution

It seems that you have the wrong impression of what an assembly language is. An assembly language is mostly a human-readable representation of a certain machine code. For a compiler there is no advantage of creating a human readable intermediate representation of the code to generate.

For Java there is no standard assembly representation at all, though there are tools dealing with pseudo-Java-assembly languages that look close to each other due to the fact that they all use the same well-kown names from the JVM specification. So, for example, you can translate all .class files into a pseudo-assembly source with the javap command shipped with the JDK. But that does not add any advantage to the tools, neither to javac nor to other programming language compilers.

Most compilers have some sort of intermediate representation while compiling but that’s not an assembly language representation.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top