14

Translators 130515215721 Phpapp01

Embed Size (px)

DESCRIPTION

compiler interpreter and assembler

Citation preview

Slide 1

Disclaimer: This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra Mentoring PartnerBaabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd2TRANSLATORS AND INTERPRETERARJUN S [email protected]/arjunaryavarthamtwitter.com/arjun.sr007Arjun.sr0079745649882

3INTRODUCTION Any program that is not written in machine language has to be translated in machine language before it is executed by the computer. The means used for translation are themselves computer programs. There are three types of translator programs i.e. Assembler, Compilers and Interpreters.

ASSEMBLER: Assembler is a computer program which is used to translate program written in Assembly Language in to machine language. The translated program is called as object program. Assembler checks each instruction for its correctness and generates diagnostic messages, if there are mistakes in the program.Translate mnemonic operation codes to their machine language equivalents. Assigning machine addresses to symbolic labels.Assembler directives (or pseudo-instructions) provide instructions to the assembler itself. They are not translated into machine instructions Eg: START,ENDThe output of the assembler program is called the object code or object program.The object code is usually amachine code, also called amachine language, which can be understood directly by a specific type of CPU (central processing unit), such as x86 (i.e., Intel-compatible) or PowerPC. However,

some compilers are designed to convert source code into anassembly languageor some other another programming language. An assembly language is a human-readable notation for the machine language that a specific type of CPU uses.An object code file can contain not only the object code, but also relocation information that thelinkeruses to assemble multiple object files to form an executable program. It can also contain other information, such as program symbols (names of variables and functions) anddebugging(i.e., removing errors) informationFLAT ASSEMBLER(FASM) are the example of one of assembler.

LABEL OPCODE OPERANDS ; COMMENTSEx: 10100101 01110001 LDA &71 01101001 00000001 ADD #&01 10000101 01110001 STA &71

Source codeAssembly processExecutable codeCOMPILER A compiler is a program that translates a program written in HLL to executable machine language. The process of transferring HLL source program in to object code is a lengthy and complex process as compared to assembling. Compliers have diagnostic capabilities and prompt the programmer with appropriate 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. The process is repeated until the program is mistake free and translated to an object code.

JOB OF COMPILER1.To translate HLL source program to machine codes.

2. To trace variables in the program

3. 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 compilers are employed. The compiler displays the list of errors and warnings for the statements violating the syntax rules of the language. Compilers also have the ability of linking subroutines of the program. Some of examples of Compiler:Microsoft Visual StudioBlueJQuincy 2005

Source codeCompilerExecutable codeINTERPRETER The basic purpose of interpreter is same as that of complier. In compiler, the program is translated completely and directly executable version is generated. Whereas interpreter translates each instruction, executes it and then the next instruction is translated and this goes on until end of the program. In this case, object code is not stored and reused. Every time the program is executed, the interpreter translates each instruction freshlyJava script, pearl,python are the examples of interpreter languages.

Source codeInterpreterExecutable codeGet next instructionADVANTAGE: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 program

DISADVANTAGE:1. Rather slow2. No object code is produced, so a translation has to be done every time the program is running.3. For the program to run, the Interpreter must be present

this presentation helped you, please visit our pagefacebook.com/baabtraand like it. Thanks in advance.www.baabtra.com|www.massbaab.com|www.baabte.com

13