Translator (Language Translator)

Translator

→ The system software that is used to translates source code into object code.
→ Computer program which translates the high level language source program into machine language.

Roles of translator
→ Translating the high level language program input into an equivalent machine language program.
→ Providing diagnostic messages wherever the programmer violates specifications of the highlevel language program. 

Types of translator
1. Assembler
→ Assembler is the types of transltor program which is used to translate the code of assembly language.
→ Convert a mnemonic code to the machine code.
→ Also convert an address to machine language
→ Stays in the secondary memory and can take in the RAM whenever required.

Usage of assembler
→ To develop built-in programs for microcontroller
→ For reverse engineering development programs
→ Used to program device drivers and some components of operating system like kernel or bootloader, menuet OS and kolibri OS

Main function of assembler
→ The only translator program to convert the mnemonic code into machine code
→ Converts the assembly address into the machine code
→ Test every instrucions and inform to the user that it is right or wrong.
→ Assembler puts every instructions and data to the main memory
→ It enforced the controller to start working from the first instructions after fixing the error of whole program
→ Assembler makes only one instruction consistency of the whole instructions of the assembly language

Advantages of assembler
→ The symbolic programming is easier to understand thus time-saving for the programmer.
→ It is easier to fix error and alter program instructions.
→ Efficiency in execution just like machine language

Disadvantages of assembler
→ It is machine dependent, cannot be used in other architecture.
→ A small change in design can invalidate the whole program
→ It is difficult to maintain

Examples
→ Fortan Assembly program (FAP)
→ Macro Assembly program (MAP)
→ Symbolic Optimal Assembly program (SOAP)

2. Compiler
→ A software that typically takes a high level language code as input and converts the input to a low level language at once.
→ A program that translate HLL code into Machine code, identifying errors and optimizing program operations
→ It converts the whole program in one session and reports errors detected after the compilation.
→ Processor dependent and platform dependent
Function of compiler
→ Converts source code into machine code, identifies error and optimize program operation
→ Translates the entire program in one session and reports error  encountered after the compilation
→ Saves the translated code to memory for execution
→ Reports errors with line number for correction
→ Allocates necessary memory space in the main memory
Advantages of compiler
→ Compiler translates full program in a single attempt. 
→ It gices faster speed and is fastest translator program
→ Compiler can detect error.
→ It allocates necessary storage in the main memory.
→ Compiler can also print the source program.
→ Provides platform independence, allowing the program to run on different machines.

Disadvantages of compiler
→ Slower execution as the entire program needs to be completed.
→ It is not easy to debugging as errors are shown at the end of the execution.
→ Hardware specific, it works on specific machine language and architecture.
Examples
→ Microsoft visual studio
→ GNU compiler collection (GCC)
→ Common Business Oriented Language (COBOL)
3. Interperter
→ A popular translator program in the world.
→ Checks the source code line by line and if an error found on any line, its stops the executin until the error is resolved.
→ A translator that effectively accepts a source program and executes it directly without producing any object code first. 
→ Translates each line of instructions at a time and executes the instruction immediately, then takes up the next line
→ Directly executes the operation specified in the source program when the inputs is given by the user.
→ Gives better error diagnostics than a compiler.
Function of interpreter
→ Converts HLL to machine language line by line, executing the program as it translate
→ Provides immediate feedback on errors for easier debugging
→ Often used as a debugging tool during software development
→ Provides a more interactive development environment allowing code testing and modification on the fly
Advantages of interpreter
→ User friendly and easy to learn
→ Error handling is very easy as compared to compiler
→ Program can be run before it is completed so, user gets partial result immediately
→ Works on small part of program and link them later into a whole programs
→ Used in almost every small computer
→ Portable so, it doesn't depend on specific hardware architecture
→ Doesn't take a large space in memory as it is small translator program
Disadvantages of interpreter
→ Can't convert a code into machine language at a time
→ Gives slower speed
→ Not good for execute a large program
→ Hard to memorize the instrucion of interpreter
Examples
→ Python: python, pypy, stackless python, Iron python
→ Ruby: Ruby MRI, YARV
→ Java: Hotspot, openJ9, Jrockit
→ Kotlin: jariko
→ OCaml
→ List processing

Post a Comment

0 Comments