Sunday, 21 February 2016

Concepts of Compiler - 1

In this post we are going to see some basic concepts of compiler, Now currently in world lot people are there who uses lot of programming languages to create a application for a same kind of computer, but how the programs developed in difference languages are running successfully in same machine. each and every languages are converted in to machine executable code called machine language This type of conversion is done by Compilers.

converting a Source Language in to some other language with equivalent operations, compilers reports the errors while trying to transferring.

Source Program   ---->>  Compiler --->> TargetProgram [Based on Machine]

Input  --->  TargetProgram --> output

Compilers  are always generate the target executable code , user have to give the input to the Target program and gets the output. There is another present in the industry that is known as interpreter

Interpreter is a another language transmitter, which doesnt generate the executable code, instead this will get the input and process with the code and gives the output.

input   + Source Program  --------->  output 

Structure of a Compiler
The input source program analyzed through the character stream , this process will create the tokens and symbol table, The Token which are generated from Lexical Analyzer is used to find the Syntax errors by processing in Syntax Analyzer,
From the syntax analyzer we will get a syntax tree which is used for the semantic analyzer to check for semantic errors.
From the syntax tree we are getting the Intermediate code, From the intermediate code we are getting the Target machine code using the Code Generator.