Reputation: 51
I recently studied that "byte code" is closer to machine language but it is a code that is not a machine language. Why we need to take an intermediate step between converting the programming language and then comes the binary code which is I am not getting like is it 10101?
Upvotes: 4
Views: 1762
Reputation: 570
Byte code is considered as the intermediate-level code between the source code and machine code. It is a low-level code that is the result of the compilation of a source code(programming language) which is written in a high-level language.It targets a virtual machine rather than a specific computer architecture. Bytecode allows a single compiled binary to run, and perform with almost native efficiency, on a diverse array of platforms.
Machine code(binary code) is in binary (0’s and 1’s) format which is completely different from the byte code and source code. It is regarded as the most lowest-level representation of the source code. Machine code is obtained after compilation or interpretation. It is also called machine language.Machine code is a set of instructions in machine language.
A virtual machine converts the bytecode into machine code.Furthermore, the main difference between machine code and bytecode is that the processor or the CPU can directly execute the machine code. On the other hand, after compiling the source code the bytecode is created. The virtual machine can execute it.
Upvotes: 2
Reputation: 23
Byte code you can say is compiled code and its platform independent thus can run anywhere if it would be machine code which is different for each platform,this is the reason we take intermediate steps to convert convert the compiled code into the machine code at runtime
Upvotes: 1
Reputation: 396
The bytecode name is derived from an instruction set that has a one-byte opcode followed by optional parameters. Bytecode is the intermediate form between compiled machine code and text. It is created using the programming language when saved, and for easy interpretation, or to reduce hardware and operating system dependency, by allowing the same type of code to be run on platforms. different platforms. Bytecode can usually be executed directly or on a virtual machine (a "p-code computer" or interpreter), or it can be further compiled into machine code for better performance.
Upvotes: 1