Education

Important of Compiler Design Tccicomputercoaching.com

What is Compiler?

A compiler is a special program that processes statements written in a particular programming language and turns them into machine language or “code” that a computer’s processor uses.

A program that translates from a low level language to a higher level one is a decompiler. A program that translates between high-level languages is usually called a source-to-source compiler or transpiler.

Compilers enabled the development of programs that are machine-independent. Before the development of FORTRAN, the first high-level language, in the 1950s, machine-dependent assembly language was widely used. While assembly language produces more abstraction than machine code on the same architecture, just as with machine code, it has to be modified or rewritten if the program is to be executed on different computer hardware architecture.

Difference between Compiler and Interpreter:

They are both similar as they achieve similar purposes, but process is different.

The compiler is itself a computer program written usually in some implementation language.

Traditionally, the source language is a high level language and the target language is a low level language (machine code).

The interpreter translates instructions one at a time, and then executes those instructions immediately.

Phases of Compiler:

Lexical analysis

Lexical analysis breaks up a program into tokens

Grouping characters into non-separatable units (tokens)

Changing a stream to characters to a stream of tokens

Syntax analysis

Checks whether the token stream meets the grammatical specification of the language and generates the syntax tree.

Semantic analysis

A context-free grammar defines the syntax of a programming language

The syntax defines the syntactic categories for language constructs

Statements

Expressions

Declaration

Intermediate (machine-independent) code generation and optimization

If we direct convert source code to object code without intermediate generate code then we need every time full native compiler. The second part of compiler, synthesis, is changed according to the target machine.

It becomes easier to apply

Intermediate code eliminates the need of a new full compiler for every unique machine by keeping the analysis portion same for all the compilers.

Machine-independent optimisations are possible Also enables interpretation. . .

Target (machine-dependent) code generation and optimization

Intermediate code from the machine-independent form assembly or object code is generated by the compiler

MOVF id3, R2

MULF #60.0, R2

MOVF id2, R1

ADDF R2, R1

MOVF R1, id1

If you want to learn more than visit our institute once in Bopal and Satellite, Ahmedabad.

Call us @ 98256 18292.

Visit us @ tccicomputercoaching.com

Mail us @ tccicoaching@gmail.com

To Learn More About  compiler design in Bopal, ahmedabad

To Know More C++ in Bopal, Ahmedabad, computer class in Bopal, Ahmedabad, computer class in satellite, Ahmedabad

Leave a comment