×
They know who you are. Show them what you can be.
--Your friends at LectureNotes
Close

Note for Compiler Design - CD by praveen kumar boddu

  • Compiler Design - CD
  • Note
  • 217 Views
  • 2 Offline Downloads
  • Uploaded 5 months ago
Praveen Kumar Boddu
Praveen Kumar Boddu
0 User(s)
Download PDFOrder Printed Copy

Share it with your friends

Leave your Comments

Text from page-1

UNIT I Introduction: Language processors, Phases of a compiler, Pass and phase, Bootstrapping, Compilerconstruction tools, Applications of compiler technology, Programming language basics Lexical Analysis: Role and Responsibility, Input buffering, Specification of tokens, Recognition of tokens, LEX tool, Design of a Lexical Analyzer generator UNIT II Syntax Analysis: Role of the parser, Context Free Grammars - Definition, Derivations, Parse trees, Ambiguity, Eliminating ambiguity, Left recursion, Left faltering. TOP Down Parsing: Recursive descent parsing, Non-recursive predictive parsing, LL(1) grammars, Error recovery in predictive parsing. Bottom Up Parsing: Handle pruning, Shift-Reduce parsing, Conflicts during shiftsreduce parsing, SLR Parsing, Canonical LR(1) parsers, LALR parsers, Using ambiguous grammars, YACC tool. UNIT III Syntax Directed Translation: Syntax Directed Definitions, Evaluation orders for SDD‘s, Application of SDT, SDT schemes, Implementing L-attribute SDD‘s. Text Books : 1. Compilers Principles, Techniques and Tools, Second Edition, Alfred V. Aho, Monica S. Lam, Ravi Sethi, Jeffrey D. Ullman., Pearson. 2. Compiler Design, K. Muneeswaran., Oxford University Press, 2012 Reference Books : 1. Compiler Construction, K.V.N Sunitha, Pearson, 2013 2. Engineering a Compiler, Second Edition, Keith D. Cooper & Linda Torczon., Morgan Kaufmann, Elsevier. 3. Compilers Principles and Practice, Parag H. Dave, Himanshu B. Dave., Pearson 4. Compiler Design, Sandeep Saxena, Rajkumar Singh Rathore., S.Chand publications 5. Compiler Design, Santanu Chattopadhyay., PHI 6. Principals of Compiler Design, Nadhni Prasad, Elsevier. CREC, Dept. of CSE Page 1

Text from page-2

UNIT -I CREC, Dept. of CSE Page 2

Text from page-3

UNIT -I PART A: INTRODUCTION 1. OVERVIEW OF LANGUAGE PROCESSING SYSTEM Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing: A preprocessor may allow a user to define macros that are short hands for longer constructs. 2. File inclusion: A preprocessor may include header files into the program text. 3. Rational preprocessor: these preprocessors augment older languages with more modern flow-of-control and data structuring facilities. 4. Language Extensions: These preprocessor attempts to add capabilities to the language by certain amounts to build-in macro Compiler Compiler is a translator program that translates a program written in (HLL) the source program and translates it into an equivalent program in (MLL) the target program. As an important part of a compiler is error showing to the programmer. Source pg Compiler target pgm Error msg CREC, Dept. of CSE Page 3

Text from page-4

Executing a program written n HLL programming language is basically of two parts. the source program must first be compiled translated into a object program. Then the results object program is loaded into a memory executed. ASSEMBLER: programmers found it difficult to write or read programs in machine language. They begin to use a mnemonic (symbols) for each machine instruction, which they would subsequently translate into machine language. Such a mnemonic machine language is now called an assembly language. Programs known as assembler were written to automate the translation of assembly language in to machine language. The input to an assembler program is called source program, the output is a machine language translation (object program). INTERPRETER: An interpreter is a program that appears to execute a source program as if it were machine language. Languages such as BASIC, SNOBOL, LISP can be translated using interpreters. JAVA also uses interpreter. The process of interpretation can be carried out in following phases. 1. Lexical analysis 2. Syntax analysis 3. Semantic analysis 4. Direct Execution Advantages: Modification of user program can be easily made and implemented as execution proceeds. Type of object that denotes various may change dynamically. Debugging a program and finding errors is simplified task for a program used for interpretation. The interpreter for the language makes it machine independent. Disadvantages:  The execution of theprogramis slower.  Memory consumption is more. CREC, Dept. of CSE Page 4

Lecture Notes