0% found this document useful (0 votes)
109 views14 pages

Compiler Principles and Challenges

This document provides an overview of compilers, including: 1) Compilers convert high-level code to machine code in one pass, while interpreters execute step-by-step. 2) The main phases of a compiler are lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation. 3) Key challenges in compiler design include supporting defined grammars/patterns efficiently, optimizing generated code, reducing compilation time, and achieving platform independence.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views14 pages

Compiler Principles and Challenges

This document provides an overview of compilers, including: 1) Compilers convert high-level code to machine code in one pass, while interpreters execute step-by-step. 2) The main phases of a compiler are lexical analysis, syntax analysis, semantic analysis, intermediate code generation, code optimization, code generation. 3) Key challenges in compiler design include supporting defined grammars/patterns efficiently, optimizing generated code, reducing compilation time, and achieving platform independence.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

Compiler Principles

(Week 1)

By
Mahalingam. P. R
S1 - CSIS
Contents
• Language Processor
• Compiler
• Phases of a compiler
• Challenges in compiler design
• Current solutions
• Scope for research
• Conclusion
Language processor
• Convert our program in high level language
(human-side) to low level language
(machine-based).
• Under our consideration:
1. Compiler (complete generation at once).
2. Interpreter (step by step execution).
Compiler
• Convert our high level program to machine
code.
• One of the most basic system software.
• The main tool of programmers worldwide.
• Example:
 C compiler
 Java bytecode generator
...
• Even the OS we use was a complex high
level code once.
• So, even the OS has to undergo a certain
level of compilation to work in the first
place.
• This is where compiler performance
matters the most...
• Reference : Design and construction of Compilers, University of Texas at Arlington
[Link]
Phases of compiler
• Lexical analysis
• Syntax analysis
• Semantic analysis
• Intermediate Code Generation
• Code Optimization
• Code Generation
• Reference: Compilers – Principles, Techniques and Tools by Alfred Aho, Jeffery
Ullmann, Ravi Sethi
• Our own Project – Compiler-Compiler Training Tool !!!
Challenges in Compiler Design
• Working for a whole set of defined
grammars and patterns.
• Efficiency of generated code.
• Optimization of the code.
• Compilation time.
• Platform independence.
• References: Design and construction of Compilers, University of Texas at Arlington
[Link]
Present solutions
• Compiler Compilers
• Local and Global optimization
• Partial Compilation
- In Java, the compiler generates only
the bytecode. It is just the partial result of
compilation. The actual code is generated
by a platform-dependent interpreter.
• Reference: Compilers – Principles, Techniques and Tools by Alfred Aho, Jeffery
Ullmann, Ravi Sethi
Scope for research
• Code optimization
• Intermediate code portability
• Incremental Compilers
• Distributed Compilation
• Compiler – Compilers
• Reference: Compilers – Principles, Techniques and Tools by Alfred Aho, Jeffery
Ullmann, Ravi Sethi

Introduction to ANTLR Parser Generator [Link]



Intermediate code portability

Incremental Compilers

Distributed Compilation
They form a chain... A portable intermediate
code can help in Incremental compilers,
and aid in developing Distributed
Compilation.
Conclusion
• Compilers are now being used more than ever.
• They are now mainly evaluated not by their
performance, but by the efficiency and portability
of the code they generate.
• But the two properties are offered only in a
limited level, by a few compilers.
• Further research is needed in the field to get a
high performance, portable code that can be
generated for any language, which might even
involve a total reassembly of the existing
compilers.
THANK YOU...

You might also like