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.
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.
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 :
|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.|
Attention reader! Don’t stop learning now. Get hold of all the important CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.