Community Sites
Create your own community website and start earning today !
It's Free !
 
Communities Members BookmarksPolls Fresher Jobs Funny Pictures MCA Projects New Member FAQ  



My Profile
Active Members
TodayLast 7 Days more...



Awards & Gifts
Online Exams

Fresher Jobs


Our fresher job section is exclusively for fresh graduates! Find jobs for freshers in major Indian cities including Bangalore, Chennai, Hyderabad, Pune or Kochi

Resources


Find educational articles, blogs, discussion threads and other resources.

Colleges


Find details about any college in India or search for courses.

website counter




Principles of Compiler Design Notes - Unit 1-part1


Posted Date: 03 Jan 2008    Resource Type: Articles/Knowledge Sharing    Category: Education

Posted By: Jagadeesan. D       Member Level: Silver
Rating:     Points: 5




Syllabus : Unit – I : INTRODUCTION TO COMPILING

Compilers – Analysis of source program – Phases of a Complier – Cousins of the Complier – Grouping of Phases – Complier construction tools – Lexical Analysis – Role of Lexical Analysis – Input Buffering – Specification of Tokens.

Notes :

Compiler :

A Compiler is a program that reads a program written in one language (Source Language like C,C++,etc…) and translate it into an equivalent program in another language (Target Language like Machine Language) and the complier reports to its user the presence of errors in the source program.

Classification of Compiler :

1. Single Pass Complier
2. Multi-Pass Complier
3. Load and Go Complier
4. Debugging or Optimizing Complier.

Software Tools :
Many software tools that manipulate source programs first perform some kind of analysis. Some examples of such tools include:

? Structure Editors :
? A structure editor takes as input a sequence of commands to build a source program.
? The structure editor not only performs the text-creation and modification functions of an ordinary text editor, but it also analyzes the program text, putting an appropriate hierarchical structure on the source program.
? Example – while …. do and begin….. end.
? Pretty printers :
? A pretty printer analyzes a program and prints it in such a way that the structure of the program becomes clearly visible.
? Static Checkers :
? A static checker reads a program, analyzes it, and attempts to discover potential bugs without running the program.

? Interpreters :
? Translate from high level language ( BASIC, FORTRAN, etc..) into assembly or machine language.
? Interpreters are frequently used to execute command language, since each operator executed in a command language is usually an invocation of a complex routine such as an editor or complier.
? The analysis portion in each of the following examples is similar to that of a conventional complier.
? Text formatters.
? Silicon Compiler.
? Query interpreters.

Analysis of Source Program :
The analysis phase breaks up the source program into constituent pieces and creates an intermediate representation of the source program. Analysis consists of three phases:
Linear analysis (Lexical analysis or Scanning)) :
? The lexical analysis phase reads the characters in the source program and grouped into them tokens that are sequence of characters having a collective meaning.
? Example : position : = initial + rate * 60
? Identifiers – position, initial, rate.
? Assignment symbol - : =
? Operators - + , *
? Number - 60
? Blanks – eliminated.

Hierarchical analysis (Syntax analysis or Parsing) :
? It involves grouping the tokens of the source program into grammatical phrases that are used by the complier to synthesize output.
? Example : position : = initial + rate * 60
Semantic analysis :
? In this phase checks the source program for semantic errors and gathers type information for subsequent code generation phase.
? An important component of semantic analysis is type checking.
? Example : int to real conversion.


Cousins of the Complier (Language Processing System) :
? Preprocessors :
? It produces input to Compiler. They may perform the following functions.
? Macro Processing :
A preprocessor may allow a user to define macros that are shorthands for longer constructs.
? File inclusion :
A preprocessor may include header files into the program text.
? Rational preprocessors :
These preprocessors augment older language with more modern flow of control and data structuring facilities.
? Language extensions :
These preprocessor attempt to add capabilities to the language by what amounts to built in macros.
? Complier :
? It converts the source program(HLL) into target program (LLL).
? Assembler :
? It converts an assembly language (LLL) into machine code.
? Loader and Link Editors :
? Loader :
? The process of loading consists of taking relocatable machine code, altering the relocatable addresses and placing the altered instructions and data in memory at the proper locations.
? Link Editor :
? It allows us to make a single program from several files of relocatable machine code.










Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
(No tags found.)

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: TEST YOUR PROGRAMMING
Previous Resource: Human Resource Management
Return to Discussion Resource Index
Post New Resource
Category: Education


Post resources and earn money!
 
Related Resources



Watch TV Channels
  • Watch Asianet TV online
  • Kairali TV in Internet
  • Surya TV online
  • Amritha TV Channel

  • Contact Us    Privacy Policy    Terms Of Use   

    SpiderWorks Technologies Pvt Ltd. 2006 - 2007 All Rights Reserved.