Describe the synthesis analysis model of compiler? in compiler designer. or Explain in detail the process of compilation? in compiler designer
- compiler is a program that convert high level language into machine level language.
- compiler is scans all the lines of source program and list out all syntax error at a time.
A compiler contain six phases which are as fallows.
1: phase 1 (Lexical analysis):
a : The lexical analyzer is also called scanner.b: The lexical analyzer phase takes source program as input and separates characters of source language into group of sting called token.
c: operator symbols such as >,>=,+,etc punctuation symbols such as parenthesis or commas.
2. phase 2(syntax analyzer):
a: the syntax analyzer phase is also called parsing phase.
b: the syntax analyzer group tokens together into syntactic structure .
c: the output of this is parse tee.
3: phase 4 (semantic analyzer ):
a: the semantic analyzer phase check the source program for semantic error and gather type information for subsequent code generation phase.
b: it uses the hierarchical structure determined by syntax analyzer phase to identify the operators and operands of expression and statements.
4: phase 4 (intermediate code generation):
a: the intermediate code generation take parse tree as an input from semantic phase and generates intermediate
b: it generates variety of code as three address code, quadruple, triple,
5: phase(code optimization):
this phase is designed to improve the intermediate code so that the ultimate object program run faster and takes less space.
6: phase (code generation):
a: it is the final phase for compiler.
b: it generates the assembly code as target language .
c: in this phase the address in the binary code is translated from logical address.
टिप्पणियाँ
एक टिप्पणी भेजें