Dakshina Ranjan Kisku
Associate Professor
Department of Computer Science and Engineering
National Institute of Technology Durgapur
[email protected]
1) Majority of texts, diagrams and tables in the slide is based
on the text book Compilers: Principles, Techniques, and
Tools by Aho, Sethi, Ullman and Lam.
2) Some texts and diagrams are based on MIT Slides on
Compilers Course 6.035.
3) Some texts and diagrams are taken from IITK slides of Prof.
S. K. Aggarwala.
• Compilers: Principles, Techniques, and Tools by Aho, Sethi, Ullman
and Lam, Addison-Wesley, 2006.
• Modern Compiler Implementation in Java (Tiger book) A.W. Appel
Cambridge University Press, 1998.
• Engineering a Compiler (Ark book) Keith D. Cooper, Linda Torczon
Morgan Kaufman Publishers, 2003.
• Advanced Compiler Design and Implementation (Whale book) Steven
Muchnick, Morgan Kaufman Publishers, 1997.
• Introduction to Compilers and Language Design, Douglas Thain, Lulu,
First Edition, 2019.
• Introduction to compilers, history of compilers, motivation, objectives, language
processing system, background issues and programming language principles.
• Syntax definition, Syntax directed translator, parsing, translator for simple expressions,
etc.
• Lexical analysis, regular expressions, finite-state machines, and scanner-generator tools.
• Parsing methods, top-down (recursive-descent, LL) and bottom-up (LR and its variants).
• Introduces the principal ideas in syntax-directed definitions and syntax-directed
translations.
• Generate intermediate code for a typical programming language.
• Run-time environments, especially management of the run-time stack and garbage
collection.
• Object-code generation. It covers construction of basic blocks, generation of code from
expressions and basic blocks, and register-allocation techniques.
• Code optimization, including ow graphs, data- ow frameworks, and iterative algorithms for
solving these frameworks.
• 1940: Programs were written in assembly language.
• 1951: The first practical compiler was written by Corrado Böhm for his PhD
thesis.
• 1951-2: Grace Hopper developed A-0 for the UNIVAC I (First implemented
compiler).
• 1952: The first Autocode and compiler in the modern sense were developed
by Alick Glennie at the University of Manchester for the Mark 1 computer.
• 1957: FORTRAN compiler developed by team led by John Backus at IBM.
(Turing award)
• 1958: The first ALGOL 58 compiler was completed by Friedrich L. Bauer et. al.,
for the Z22 computer.
• 1960s: Development of the first bootstrapping compiler for LISP.
• Theory of Computation –
• Finite State Automata, Grammars and Parsing, data-flow
• Algorithms –
• Graph manipulation, dynamic programming
• Data structures –
• Symbol tables, abstract syntax trees
• Systems –
• Allocation and naming, multi-pass systems,
• Computer Architecture –
• Memory hierarchy, instruction selection, interlocks and latencies, parallelism
• Security –
• Detection of and Protection against vulnerabilities
• Software Engineering –
• Software development environments, debugging
• Artificial Intelligence –
• Heuristic based search for best optimizations
• How about natural languages?
• English??
• “Open the directory where a couple of pdf files are kept.”
• “I am sorry Ravi, am afraid cannot do that”
• We are not there yet!!
• Natural Languages:
• Powerful, but…
• Ambiguous
• Same expression describes many possible actions
• Properties
• need to be precise
• need to be concise
• need to be expressive
• need to be at a high-level (lot of abstractions)
PROJECT MANAGERS
“I want UVT project get done by next week.”
PROJECT LEADERS
“Get fixed-deposit and rollback modules done within next couple of days.”
SOFTWARE ENGINEER/PROGRAMMER
“Just follow the instructions”
• Write a program using a programming language
• High-level Abstract Description
• Microprocessors talk in assembly language
• Low-level Implementation Details
• Compiler does the translation
• Read and understand the program
• Precisely determine what actions it require
• Figure-out how to faithfully carry-out those actions
• Instruct computer to carry out those actions
• Standard Imperative Language (C, C++, Java)
• State
• Variables
• Structures,
• Arrays
• Computation
• Expressions (arithmetic, logical, etc.)
• Assignment statements
• Control flow (conditionals, loops)
• Procedures
• State
• Registers
• Memory with Flat Address Space
• Machine code
• load/store architecture
• Load, store instructions
• Arithmetic, logical operations on registers
• Branch instructions
• A compiler is a program that can read a program in one language and
translate it into an equivalent program in another language.
• An important role of the compiler is to report any errors in the source
program that it detects during the translation process.
Language processing system:
Process of execution of programs
• Preprocessor
• Compiler
• Assembler
• Linker/Loader
• Language processing is an important component of programming.
• A large number of systems software and application programs require
structured input.
Operating Systems (command line processing)
Databases (Query language processing)
Type setting systems like Latex
• Software quality assurance and software testing.
• Where ever input has a structure one can think of language
processing
• To learn how to design and implement compilers.
• Understand, modify and maintain compilers.
• Learn to use language processing technology for software development
• Compilers enable programming language instead of machine
instructions.
• Flexibility, Portability, Modularity, Simplicity, Programmer Productivity
• Also Efficiency and Performance