Disclaimer: This presentation is prepared by trainees ofbaabtra as a part of mentoring program. This is not officialdocument of baabtra –Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .Ltd
TRANSLATORS ANDINTERPRETERARJUN S RArjun.firstname.lastname@example.org/arjunaryavarthamtwitter.com/arjun.sr007Arjun.sr0079745649882
INTRODUCTIONAny program that is not written in machine languagehas to be translated in machine language before it isexecuted by the computer. The means used for translationare themselves computer programs. There are three types oftranslator programs i.e. Assembler, Compilers andInterpreters.
ASSEMBLER:Assembler is a computer program which is used to translate programwritten in Assembly Language in to machine language. The translatedprogram is called as object program. Assembler checks each instructionfor its correctness and generates diagnostic messages, if there aremistakes in the program.• Translate mnemonic operation codes to their machine languageequivalents. Assigning machine addresses to symbolic labels.• Assembler directives (or pseudo-instructions) provide instructions to theassembler itself. They are not translated into machine instructionsEg: START,END• The output of the assembler program is called the object code or objectprogram.• The object code is usually a machine code, also called a machine language,which can be understood directly by a specific type of CPU (centralprocessing unit), such as x86 (i.e., Intel-compatible) or PowerPC. However,
• some compilers are designed to convert source code intoan assembly language or some other another programminglanguage. An assembly language is a human-readable notation forthe machine language that a specific type of CPU uses.• An object code file can contain not only the object code, but alsorelocation information that the linker uses to assemble multipleobject files to form an executable program. It can also contain otherinformation, such as program symbols (names of variables andfunctions) and debugging (i.e., removing errors) information• FLAT ASSEMBLER(FASM) are the example of one of assembler.LABEL OPCODE OPERANDS ; COMMENTSEx: 10100101 01110001 LDA &7101101001 00000001 ADD #&0110000101 01110001 STA &71Source code Assembly process Executable code
COMPILERA compiler is a program that translates a program written inHLL to executable machine language. The process oftransferring HLL source program in to object code is a lengthyand complex process as compared to assembling. Compliershave diagnostic capabilities and prompt the programmer withappropriate error message while compiling a HLL program.The corrections are to be incorporated in the program,whenever needed, and the program has to be recompiled. Theprocess is repeated until the program is mistake free andtranslated to an object code.
JOB OF COMPILER1.To translate HLL source program to machine codes.2. To trace variables in the program3. To include linkage for subroutines.4. To allocate memory for storage of program and variables.5. To generate error messages, if there are errors in then program.
High-level languages such as C, C++ and Java compilersare employed. The compiler displays the list of errors andwarnings for the statements violating the syntax rules of thelanguage. Compilers also have the ability of linkingsubroutines of the program.• Some of examples of Compiler:o Microsoft Visual Studioo BlueJo Quincy 2005Source code Compiler Executable code
INTERPRETERThe basic purpose of interpreter is same as that of complier.In compiler, the program is translated completely and directlyexecutable version is generated. Whereas interpreter translateseach instruction, executes it and then the next instruction istranslated and this goes on until end of the program. In thiscase, object code is not stored and reused. Every time theprogram is executed, the interpreter translates each instructionfreshly
• Java script, pearl,python are the examples of interpreterlanguages.Source code Interpreter Executable codeGet next instruction
ADVANTAGE:1. Good at locating errors in programs2. Debugging is easier since the interpreter stops when it encounters an error.3. If an error is deducted there is no need to retranslate the whole programDISADVANTAGE:1. Rather slow2. No object code is produced, so a translation has to be done every time theprogram is running.3. For the program to run, the Interpreter must be present
this presentation helped you, please visit ourpage facebook.com/baabtra and like it.Thanks in advance.www.baabtra.com | www.massbaab.com |www.baabte.com