8

Compiler

Embed Size (px)

Citation preview

Page 1: Compiler
Page 2: Compiler

What is a What is a CompilerCompiler ? ?

•Compiler is a translator program that converts a High level Compiler is a translator program that converts a High level programming language to machine language.programming language to machine language.•Machine Language consists of 1 and 0 i.e. ,ON &OFF.Machine Language consists of 1 and 0 i.e. ,ON &OFF.

Page 3: Compiler

How Compiler CompilesHow Compiler Compiles

COMPILERINPUT(SOURCE PROGRAM)

OUTPUT(MACHINE LANGUAGE

PROGRAM)

Page 4: Compiler

Features of a CompilerFeatures of a Compiler

A Compiler could understand it's own A Compiler could understand it's own language not other compilers language not other compilers language.language.

For example, A C Compiler does not For example, A C Compiler does not understand a Java Source Program.understand a Java Source Program.

Compiler will check for Syntax Errors Compiler will check for Syntax Errors in Source Programs.in Source Programs.

Page 5: Compiler

Execution of a CompilerExecution of a Compiler

Secondary StroargeWhere Compiler is stored

Primary Memory

Page 6: Compiler

Features of CompilerFeatures of Compiler

Translation of High Level Language to Translation of High Level Language to Machine Language.Machine Language.

Detect errors in source program i.e. Detect errors in source program i.e. encountered due to mistake in editing.encountered due to mistake in editing.

These errors are called These errors are called Syntax ErrorsSyntax Errors..

Page 7: Compiler

Start

Edit Source Program

Compile Source Program

SyntaxErrors

Detected ?

Genrerate list of coded error msgs.

Genrerate Object Program

STOP

NO

YES

Page 8: Compiler