Compiler Design: Text Book
Compiler Design: Text Book
Other 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 a 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 as SQL.
Many software having a complex front-end may need techniques used in compiler design.
A symbolic equation solver which takes an equation as input. That program should parse the given input
equation.
Most of the techniques used in compiler design can be used in Natural Language Processing (NLP) systems.
An interpreter reads an executable source program written in a
high-level programming language as well as data for this program,
and it runs the program against the data to produce some results.
One example is the Unix shell interpreter, which runs operating
system commands interactively
Cousins of compiler
Preprocessor(Macro processing, file inclusion, Rational preprocessor, Language extensions)
Assembler
Linkers-A linker takes several object les and libraries as input and produces one executable object file. It
retrieves from the input files (and puts them together in the executable object file) the code of all the referenced
functions/procedures and it resolves all external references to real addresses. The libraries include the operating
system libraries, the language-specic libraries, and, maybe, user-created libraries.
Loaders
Debuggers-used to determine execution errors in a compiled program
Profiler- Collects Statistics on the behavior of the object program during execution
Project Managers-used to coordinate and merge the source code produced by different members of the
team
What is the Challenge in compiler Design?
Many variations:
many programming languages (eg, FORTRAN, C++, Java)
many programming paradigms (eg, object-oriented, functional, logic)
many computer architectures (eg, MIPS, SPARC, Intel, alpha)
many operating systems (eg, Linux, Solaris, Windows)
Analysis:
Lexical analysis
Syntax analysis
Semantic analysis
Synthesis:
Intermediate code generation
code optimization
Final code generation
Storage a
position := initial + rate * 60
lexical analyzer
syntax analyzer
id2
* temp1 := id3 * 60.0
id3 id1 := id2 + temp1
60
semantic analyzer
code generator
:= MOVF id3, R2
MULF #60.0, R2
id1 + MOVF id2, R1
ADDF R2, R1
MOVF R1, id1
id2 *
id3 inttoreal
60