Applications
In addition to the development of a compiler, the techniques used in compiler design can be applicable to many problems in computer science.
- Techniques used in lexical analyzer can be used in text editors, information retrieval system and pattern recognition programs.
- Techniques used in a parser can be used in a query processing system such SQL.
- Many software having a complex front-end may need the techniques used in compiler design.
- Most of the techniques used in compiler design can be used in Natural language Processing systems.
Why Language translators?
- Programming languages are used to express ideas to a computer
- Some programming languages are written in natural languages (i.e. English)
- Computer can't understand natural language i.e., it can understand only binary language/ manchine language (0's and 1's)
- To run a program, it must first be translated into a machine form so that it canbe executed by a computer
- This job is done by the language translators
- Language translator is a system software that converts a code from one form of a language to another form of language
Example: Compilers, Interpreters, Assemblers.
Definition of Compiler
- Compiler is a program which takes one language (source program) as input and translates it into an equivalent another language (target program)
- During this process of translation if some errors are encountered, then compiler displays them as error messages. The model of compiler can be represented as follows
Properties of Compiler
When a compiler is built, it should posses the following properties:
- The compiler itself must be bug-free
- It must generate correct machine code
- The generated machine code must run fast
- The compiler itself must run fast(compilation time must be proportional to program size)
- The compiler must be portable(i.e., modular, supporting separate compilation)
- It must give good diagnostics and error messages
- The generated code must work well with existing debuggers
- It must have consistent optimization