Compiler Construction (CS-636) Muhammad Bilal Bashir UIIT, Rawalpindi
Outline Introduction to the Course Introduction to Compiler Summary Course Objectives Organization of the Course Topics to be Covered Pre-requisites & Evaluation Introduction to Compiler Summary
Introduction to the Course Compiler Construction CS-636
Course Introduction At the end of the course, students should understand the overall structure of a compiler, and will have the knowledge of the significant details of a number of important techniques commonly used. The language features that raise challenges for compiler builders are also introduced in this course.
Course Objectives To teach students the basic concepts of compilers, their components and how they work together To get lexical analyzer and syntax analyzer implemented of any programming language, most likely C++
Organization of the Course Theoretical This part will be covered through lectures delivered with the help of slides during class meetings Presentation Students will be given a topic to prepare a brief presentation. The presentation will be scheduled in the later part of the semester Project Implementation of Lexical Analyzer and Parser of C++ will be required from the students
Topics to be Covered Compiler introduction Organization of compilers Background / Revision of Automata Concepts Lexical analysis Syntax analysis Parsing techniques Object code generation and optimization Detection and recovery from errors Advanced Topics
Pre-requisites & Evaluation Automata Theory Computer Programming Evaluation Mid-term Exam 30% Final Exam 50% Project & Presentations 20%
Miscellaneous Online Course Folder http://jbillu.net/cc/ How to Reach Me bilalbezar@gmail.com Subject: CC - XYZ
Introduction to Compiler Lecture: 1
What is a Compiler? Compiler is a tool: which translate notations from one system to another, usually from source code (high level code) to machine code (object code, target code, low level code).
What is a Compiler? (Continue…) A computer program translates one language to another A compiler is a complex program From 10,000 to 1,000,000 lines of codes Compilers are used in many forms of computing Command interpreters, interface programs Compiler Source Program Target
What is Involved in Compilers? Programming Languages Formal Languages Regular Expressions & Automata Theory Applications Programming Languages ? We use natural languages to communicate We use programming languages to speak with computers
Why Compiler? Writing machine language-numeric codes is time consuming and tedious C7 06 0000 0002 Mov x, 2 X=2 The assembly language has a number of defects Not easy to write Difficult to read and understand
Brief History of Compiler The first compiler was developed between 1954 and 1957 The FORTRAN language and its compiler by a team at IBM led by John Backus The structure of natural language was studied at about the same time by Noam Chomsky Chomsky classified languages according to the complexity of their grammar Chomsky’s Hierarchy, as it is now called have four levels of grammar type 0, 1, 2, and 3 The type 2 or context free grammar is considered the most useful for programming languages
Brief History of Compiler (Continue…) Recent advances in compiler design More sophisticated algorithms for inferring and/or simplifying the information contained in program, such as the unification algorithm of Hindley-Milner type checking Window-based Interactive Development Environment IDE that includes editors, linkers, debuggers, and project managers However, the basic of compiler design have not changed much in the last 50+ years
Files Involved in Compiler Operations A source code text file (.c, .cpp, .java, etc. file extensions) Intermediate code files: transformations of source code during compilation, usually kept in temporary files rarely seen by the user An assembly code text file containing symbolic machine code, often produced as the output of a compiler (.asm, .s file extensions)
Files Involved in Compiler Operations (Continue…) One or more binary object code files: machine instructions, not yet linked or executable (.obj, .o file extensions) A binary executable file: linked, independently executable (well, not always…) code (.exe, .out extensions, or no extension)
Summary Any Questions?