What is Compilers ? Properties of Compiler ?
Compilers are basically translators.Translator
A kind of program that takes one form of program as input and converts it into another form.
The input called source program and the output program called target program.
Source program: Assembly language
High level Language:C,C++,Java,Fortran
Types of translator
1.Compiler
2.Assember
Functions of translator:
1.Used to convert one form of program to other.
2.Preserve the meaning of the source code.
3.Report errors that occur during compilation to its users.
4.The translation must be done efficiently.
Compiler: A program which takes one language (source program) as input and translates it into an equivalent another language(target program).
Assembler:Converts assembly language program to machine language program.
Properties of Compiler:
1.The compiler itself must be bugfree.
2.It must generate correct machine code.
3.The generated machine code must run fast.
4.The compiler itself must run fast.The compilation time must must be proportional to program size.
5.It must be portable.
6.It must give good diagnostics and error messages.
7.The generated code must work well with existing debuggers.
8.Consistent optimization.
Phases of compiler
1.Analysis phase
2.Sysnthesis phase
Analysis of source program:
1.Linear phase:The source string is read from left to right and grouped into tokens.
Tokens:identifiers,constants,relational operators,keywords
2.Hierarchical anakysis:charcters or tokens are grouped hierarchically for checking the syntactically.
3.Semantic analysis:ensures the correctness of meaning of the program.
No comments:
Post a Comment
Please Comment Your Valuable Feedback....