answersLogoWhite

0


Best Answer

They are the same thing. Every machine type has its own version of machine code, the native language of the machine (native machine code). All high-level code must be converted to native machine code before it can execute. Machine code is machine dependent but high-level code is generally machine-independent, thus the same source code can generally be converted to suit any type of machine using a suitable compiler or interpreter.

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is this native code and what is difference between native code and machine code?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are the five examples computer language?

Machine code, assembly language, COBOL, FORTRAN and C. Machine code is the only language that is native to the machine. All others must be converted to machine code.


What is compiled code?

Compiled code is plain-text source code that is translated from an English-like, high-level language into either machine code or byte code by a program known as a compiler. Machine code is the native language of the machine, consisting of binary patterns that represent a sequence of machine instructions and their operands. Byte code is the native language of a virtual machine; a machine that only exists within a computer's memory. The virtual machine is simply a program that interprets the byte code in order to produce the actual machine code. Unlike machine code which must be compiled separately for each platform, byte code will run on any platform that has a corresponding virtual machine implementation.


What converts a high level language into a machine language line by line?

An interpreter. Not to be confused with a compiler which compiles the entire program into native machine code, optimising the resultant code for efficiency. However, some compiled languages, such as Java, compile to byte code rather than machine code. Java byte code must still be interpreted by the Java Virtual Machine runtime in order to produce the required machine code, which is more efficient than a fully-interpreted language would be, but nowhere near as efficient as a native machine code compilation would be. The problem with native machine code is that it is non-portable; it must be recompiled for each target platform, whereas interpreted languages do not (the interpreter handles the machine-specifics at runtime).


What is the difference between target code and source code?

Source code and target code are the input and output of programming language translation programs such as assemblers, compilers and interpreters. An assembler is used to convert low-level assembly instructions into native machine code, thus the source code is assembly language and the target code is native machine code. The target code is typically saved to a file known as an executable. Once converted to native machine code, no further translation is required; the executable can be executed at a later date and as often as required upon any machine of the same type and equivalent system and supporting libraries and software, and with optimal execution speed. An interpreter is used to convert a high-level language source to machine code while the source code is executing. The source code is executed by the interpreter but, unlike an assembler, the resultant machine code is not saved to a file. As such, the source code must be re-interpreted every time it is executed, thus execution speed is extremely slow. However, the source code is extremely portable and can be executed upon any machine that has a suitable interpreter. The main advantage of interpreted languages is that the source code can be changed while it is executing, so the programmer can see the effect immediately. A compiler is used to convert source code written in a high-level programming language to that of a lower-level target language. Typically the lower-level language is native machine code and, as with assembly, the target code can be saved and executed at a later date with optimal performance. However, not all compilers compile to machine code. Some compile to assembly (which requires an assembler to complete the translation) while others convert to an intermediate code known as byte code. Byte code is intended to be interpreted by a virtual machine and can be thought of as being the native language of the virtual machine. As with all interpreted languages, the byte code is extremely portable and can be executed upon any physical machine that supports the appropriate virtual machine implementation. Java is an example of this. Compilers can also translate code between two high-level languages so long as the target language is a lower level than the source language. The original C++ compiler worked this way, translating the C++ source into a C target which could then be compiled to machine code using the C compiler.


How does a high level language relate to the microprocessor's instruction set?

Generally speaking, it doesn't relate at all. If it did, it wouldn't be high-level, it would be machine-dependent. The relationship between the high-level code and the machine-code is ultimately determined by the language translator (compiler and/or interpreter) but, unlike assembly language which maps 1:1 with the microprocessor instruction set, compilers and interpreters are code generators and there is seldom a 1:1 relationship between the high-level source code and the machine code.

Related questions

What is byte code and native code?

native code is machine code each machine has its won set of istruction one machine's native code won't run on another While bytecode is what java produces and it can run on any machine. when we run bytecode it first get to compile to machine code and then get to run.


What is BYTE Code in java?

Java byte code is the code that is output by the Java compiler. Byte code is not machine code, it must be interpreted to create the machine code. This is handled by the Java virtual machine. Pretty much every platform produced today has a Java virtual machine implementation, so the same byte code can be executed upon any machine. Byte code can be regarded as being the native language of the virtual machine, as opposed to machine code which is the native language of the physical machine.


What are the five examples computer language?

Machine code, assembly language, COBOL, FORTRAN and C. Machine code is the only language that is native to the machine. All others must be converted to machine code.


Which software runs a specific program?

It depends on which specific program you have in mind. Native machine code programs do not require any software to run; the program was converted into the machine's native language during compilation and does not require further translation. However, machine code is non-portable. To execute the same program on another platform the source code must be recompiled for that platform. Conditional compilation directives ensure that the correct machine-specific source code is compiled. Byte code programs, however, do require software to execute. Byte code is not native machine code so must be converted to native machine code while it is executing. This is achieved using a runtime program known as an interpreter. Java is a typical example. Java source code is compiled to Java byte code suitable for interpretation by the Java virtual machine (JVM). Thus a JVM is required to execute Java programs. Unlike native machine code, byte code is portable; the same byte code will execute upon any machine that has a suitable interpreter available.


Which software runs specific program.?

It depends on which specific program you have in mind. Native machine code programs do not require any software to run; the program was converted into the machine's native language during compilation and does not require further translation. However, machine code is non-portable. To execute the same program on another platform the source code must be recompiled for that platform. Conditional compilation directives ensure that the correct machine-specific source code is compiled. Byte code programs, however, do require software to execute. Byte code is not native machine code so must be converted to native machine code while it is executing. This is achieved using a runtime program known as an interpreter. Java is a typical example. Java source code is compiled to Java byte code suitable for interpretation by the Java virtual machine (JVM). Thus a JVM is required to execute Java programs. Unlike native machine code, byte code is portable; the same byte code will execute upon any machine that has a suitable interpreter available.


What is compiled code?

Compiled code is plain-text source code that is translated from an English-like, high-level language into either machine code or byte code by a program known as a compiler. Machine code is the native language of the machine, consisting of binary patterns that represent a sequence of machine instructions and their operands. Byte code is the native language of a virtual machine; a machine that only exists within a computer's memory. The virtual machine is simply a program that interprets the byte code in order to produce the actual machine code. Unlike machine code which must be compiled separately for each platform, byte code will run on any platform that has a corresponding virtual machine implementation.


Technical difference between native code and cross compiler?

Native code is simply machine-dependent code (machine code). It is the only language "understood" by the machine, however the code is non-portable; the code will only execute correctly upon the platform (the architecture and operating system) for which it was specifically intended. A cross-compiler is a compiler which is capable of producing machine code for machines other than (or in addition to) the one upon which the compiler is executing. This is useful for creating software for systems which cannot be programmed directly, such as SmartPhones. Instead, the software is developed on another system (such as a PC or Mac) and compiled with a cross-compiler. A compiler is simply a software program which converts high-level code into a lower-level code. The lower-level code is typically native machine code but there are exceptions. For example, the Java compiler compiles to Java byte code which is suitable for interpretation by any Java virtual machine implementation. There are also compilers that can convert C++ to C. However, it is not possible to increase the amount of abstraction using a compiler -- this can only be done manually.


What does a compiler perform?

A compiler converts high-level source code into native machine. In the case of Java, source code is compiled to Java byte code suitable for interpretation by the Java virtual machine which produces the machine code.


What converts a high level language into a machine language line by line?

An interpreter. Not to be confused with a compiler which compiles the entire program into native machine code, optimising the resultant code for efficiency. However, some compiled languages, such as Java, compile to byte code rather than machine code. Java byte code must still be interpreted by the Java Virtual Machine runtime in order to produce the required machine code, which is more efficient than a fully-interpreted language would be, but nowhere near as efficient as a native machine code compilation would be. The problem with native machine code is that it is non-portable; it must be recompiled for each target platform, whereas interpreted languages do not (the interpreter handles the machine-specifics at runtime).


Is MSIL similar to java byte code?

Yes, in some way it's similar. One difference is that Java Bytecode is typically interpreted by the virtual machine, while MSIL is JIT-compiled to native machine code before executing. However, it is increasingly common for bytecode to be compiled as well.


What is a NET CLR file?

The CLR in the .NET framework is the Common Language Runtime. Basically, it's an intermediate step between the .NET languages' source code and native machine code. When you compile something in VB or in C#, it'll be translated into CIL (Common Intermediate Language) code. Later on when you run your program, the CIL code will be compiled into native code on-the-fly.


What is the difference between source code and target code?

Source code and target code are the input and output of programming language translation programs such as assemblers, compilers and interpreters. An assembler is used to convert low-level assembly instructions into native machine code, thus the source code is assembly language and the target code is native machine code. The target code is typically saved to a file known as an executable. Once converted to native machine code, no further translation is required; the executable can be executed at a later date and as often as required upon any machine of the same type and equivalent system and supporting libraries and software, and with optimal execution speed. An interpreter is used to convert a high-level language source to machine code while the source code is executing. The source code is executed by the interpreter but, unlike an assembler, the resultant machine code is not saved to a file. As such, the source code must be re-interpreted every time it is executed, thus execution speed is extremely slow. However, the source code is extremely portable and can be executed upon any machine that has a suitable interpreter. The main advantage of interpreted languages is that the source code can be changed while it is executing, so the programmer can see the effect immediately. A compiler is used to convert source code written in a high-level programming language to that of a lower-level target language. Typically the lower-level language is native machine code and, as with assembly, the target code can be saved and executed at a later date with optimal performance. However, not all compilers compile to machine code. Some compile to assembly (which requires an assembler to complete the translation) while others convert to an intermediate code known as byte code. Byte code is intended to be interpreted by a virtual machine and can be thought of as being the native language of the virtual machine. As with all interpreted languages, the byte code is extremely portable and can be executed upon any physical machine that supports the appropriate virtual machine implementation. Java is an example of this. Compilers can also translate code between two high-level languages so long as the target language is a lower level than the source language. The original C++ compiler worked this way, translating the C++ source into a C target which could then be compiled to machine code using the C compiler.