Difference between Cross-Assembler and Compiler

1. Cross-Assembler :
A cross-assembler is an assembler that runs on a computer with one type of processor but generates machine code for a different type of processor. For example, if we use a PC with the 8086 compatible machine language to generate a machine code for the 8085 processor, we need a cross-assembler program that runs on the PC compatible machine but generates the machine code for 8085 mnemonics. It takes assembly language as input and give machine language as output.


Figure – Cross-Assembler


In the above block diagram, we can see that there is an assembler which is running on Machine B but converting assembly code of Machine A to machine code, this assembler is Cross-assembler.

Features of Cross-Assembler :

  • Cross-assembler is used to convert assembly language into binary machine code.
  • Cross-assemblers are also used to develop program which will run on game console and other small electronic system which are not able to run development environment on their own.
  • Cross-assembler can be used to give speed development on low powered system.
  • C 64 is the best example of Cross-assembler.

2. Compiler :
A compiler is a software (program) that translate source code from a high-level programming language to a machine level language. It is not as simple as assembler’s translation. It has to perform several steps to produce an object file in machine code form. The main job of the compiler is that it checks all kinds of limits, ranges, errors, etc. The process of converting high level language to machine language is known Compilation. If something is wrong in code, then it will give errors.




Figure – Compiler


Features of Compiler :

  • After executing program, the first task of compiler is to create .obj file and then .exe file.
  • Compiler manages the storage of code and variable.
  • Compiler is responsible for correctness of code and highlights the errors.
  • Compiler is more intelligent then cross-assembler.
  • MinGW, javac are the examples of compiler.


Difference between Cross-Assembler and Compiler :

S.No. CROSS-ASSEMBLER COMPILER
1 A cross-assembler is an assembler that runs on a computer with one type of processor but generates machine for different type of processor. Compiler is used to convert source code from High level language to machine level language.
2 Cross-assembler inputs assembly language code. Compiler input source code.
3 Cross-assembler can’t do this at once. Compiler can converts the whole code into machine language at a time.
4 Cross-assembler is less intelligent. It is more intelligent than cross-assemblers.
5 The output of cross-assembler is in binary code. The output of compiler is in machine code.
6 Cross-assembler can cooperate with two processor at a time. Whereas compiler works on one processor at a time.
7 The example of Cross-assembler is C 64. compiler examples are GCC, javac, MinGW etc.

Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.


Article Tags :

2


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.