


The blanks separating the characters of the tokens and the comments statements appearing within the program would normally be eliminated during lexical analysis. Lexical Analysis or Linear Analysis or Scanning, in which the stream of characters making up the source program is read from left-to-right and grouped in to tokens, sequence of characters having a collective meaning. The phases of a compiler are: I)Lexical Analysis
Advanced compiler design and implementation pdf code#
While the other two Code Optimization and Code Generation are part of Synthesis phases, which are highly machine dependent phases. The first four Lexical analysis, Syntax analysis, Semantic analysis and Intermediate Code Generation are part of Analysis phases, which are machine independent phases. There are mainly SIX phases of a compiler. The intermediate code so produced is 8086 Assembly code, which is converted into an executable by using MASM. The third phase, Semantic Analyzer, and the fourth phase, Intermediate Code Generation, are carried out as the part of action corresponding to the production rules in the parser. The second phase, Syntax Analyzer, is being implemented by using Yacc tool provided by Linux.

The first phase of the compiler, Lexical Analyzer, is being implemented by using LEX tool provided with Linux. Here we have produced 8086 Assembly level code for the given source code. Target program can be either Assembly language code or machine code. Here our source program is ANSI C program. It reports errors detected during the translation of source code to target code.Source program can be of any programming language. It was very successful.Ĭompiler is a program that reads a program written in one language, called source language, and translated it in to an equivalent program in another language, called target language. And I have generated final code in X86 machine and used MASM assembler to run the code. I have used LEX and YACC tools to generate the Lexical and Syntax analysis. Though it is C-compiler the concept of all the compilers will be almost same. This is my project during my bechlor degree program.
