G53CMP: Lecture 1. Administrative Details 2016 and Introduction to Compiler Construction. Henrik Nilsson. University of Nottingham, UK

Size: px
Start display at page:

Download "G53CMP: Lecture 1. Administrative Details 2016 and Introduction to Compiler Construction. Henrik Nilsson. University of Nottingham, UK"

Transcription

1 G53CMP: Lecture 1 Administrative Details 2016 and Introduction to Compiler Construction Henrik Nilsson University of Nottingham, UK G53CMP: Lecture 1 p.1/39

2 Finding People and Information (1) Henrik Nilsson Room A08, Computer Science Building Teaching Assistant (TA): Jonathan Fowler G53CMP: Lecture 1 p.2/39

3 Finding People and Information (2) Main module web page: G53CMP: Lecture 1 p.3/39

4 Finding People and Information (2) Main module web page: Moodle: moodle.nottingham.ac.uk/ course/view.php?id=45541 G53CMP: Lecture 1 p.3/39

5 Finding People and Information (2) Main module web page: Moodle: moodle.nottingham.ac.uk/ course/view.php?id=45541 Direct questions concerning lectures and coursework to the Moodle G53CMP Forum. G53CMP: Lecture 1 p.3/39

6 Finding People and Information (2) Main module web page: Moodle: moodle.nottingham.ac.uk/ course/view.php?id=45541 Direct questions concerning lectures and coursework to the Moodle G53CMP Forum. Anyone can ask and answer questions, but you must not post exact solutions to the coursework. G53CMP: Lecture 1 p.3/39

7 Aims and Motivation (1) Why study Compiler Construction? G53CMP: Lecture 1 p.4/39

8 Aims and Motivation (1) Why study Compiler Construction? Why did you opt to take this module? G53CMP: Lecture 1 p.4/39

9 Aims and Motivation (1) Why study Compiler Construction? Why did you opt to take this module? More generally, what do you think are good reasons to take this module? G53CMP: Lecture 1 p.4/39

10 Aims and Motivation (2) Aims: Deepened understanding of: G53CMP: Lecture 1 p.5/39

11 Aims and Motivation (2) Aims: Deepened understanding of: how compilers (and interpreters) work and are constructed G53CMP: Lecture 1 p.5/39

12 Aims and Motivation (2) Aims: Deepened understanding of: how compilers (and interpreters) work and are constructed programming language design and semantics G53CMP: Lecture 1 p.5/39

13 Aims and Motivation (2) Aims: Deepened understanding of: how compilers (and interpreters) work and are constructed programming language design and semantics The former is a great, hands on, learning-by-doing way to learn the latter. G53CMP: Lecture 1 p.5/39

14 Aims and Motivation (3) Why? G53CMP: Lecture 1 p.6/39

15 Aims and Motivation (3) Why? The ACM/IEEE 2013 CS Curriculum Guidelines: G53CMP: Lecture 1 p.6/39

16 Aims and Motivation (3) Why? The ACM/IEEE 2013 CS Curriculum Guidelines: Graduates should realize that the computing field advances at a rapid pace, and graduates must possess a solid foundation that allows and encourages them to maintain relevant skills as the field evolves. Specific languages and technology platforms change over time.... G53CMP: Lecture 1 p.6/39

17 Aims and Motivation (3) Why? The ACM/IEEE 2013 CS Curriculum Guidelines:... Therefore, graduates need to realize that they must continue to learn and adapt their skills throughout their careers. To develop this ability, students should be exposed to multiple programming languages, tools, paradigms, and technologies as well as the fundamental underlying principles throughout their education. G53CMP: Lecture 1 p.6/39

18 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] G53CMP: Lecture 1 p.7/39

19 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory G53CMP: Lecture 1 p.7/39

20 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms G53CMP: Lecture 1 p.7/39

21 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms Computer architecture G53CMP: Lecture 1 p.7/39

22 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms Computer architecture Programming language semantics G53CMP: Lecture 1 p.7/39

23 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms Computer architecture Programming language semantics Formal reasoning about programs G53CMP: Lecture 1 p.7/39

24 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms Computer architecture Programming language semantics Formal reasoning about programs Software engineering aspects G53CMP: Lecture 1 p.7/39

25 Aims and Motivation (4) Moreover: Compilers: a microcosm of computer science [CT04] Formal Languages and Automata Theory Datastructures and algorithms Computer architecture Programming language semantics Formal reasoning about programs Software engineering aspects Thus, capstone module tying everything together. G53CMP: Lecture 1 p.7/39

26 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G53CMP: Lecture 1 p.8/39

27 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G52MAL: formal language theory, grammars, (D)FAs G53CMP: Lecture 1 p.8/39

28 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G52MAL: formal language theory, grammars, (D)FAs G51MCS, G52IFR: formal reasoning, structural induction G53CMP: Lecture 1 p.8/39

29 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G52MAL: formal language theory, grammars, (D)FAs G51MCS, G52IFR: formal reasoning, structural induction G51PRG, G51FUN, G51OOP: programming, understanding programming languages G53CMP: Lecture 1 p.8/39

30 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G52MAL: formal language theory, grammars, (D)FAs G51MCS, G52IFR: formal reasoning, structural induction G51PRG, G51FUN, G51OOP: programming, understanding programming languages G51CSA: how computers work G53CMP: Lecture 1 p.8/39

31 Aims and Motivation (5) Or, in terms of modules, G53CMP directly draws from/informs: G52MAL: formal language theory, grammars, (D)FAs G51MCS, G52IFR: formal reasoning, structural induction G51PRG, G51FUN, G51OOP: programming, understanding programming languages G51CSA: how computers work G54FOP/FPP: programming language theory G53CMP: Lecture 1 p.8/39

32 Aims and Motivation (6) Jobs? G53CMP: Lecture 1 p.9/39

33 Aims and Motivation (6) Jobs? There are plenty of companies out there with in-house languages or that critically rely on compiler/interpreter expertise for other reasons. Some possibly surprising examples: G53CMP: Lecture 1 p.9/39

34 Aims and Motivation (6) Jobs? There are plenty of companies out there with in-house languages or that critically rely on compiler/interpreter expertise for other reasons. Some possibly surprising examples: Facebook G53CMP: Lecture 1 p.9/39

35 Aims and Motivation (6) Jobs? There are plenty of companies out there with in-house languages or that critically rely on compiler/interpreter expertise for other reasons. Some possibly surprising examples: Facebook Standard Chartered Bank G53CMP: Lecture 1 p.9/39

36 Aims and Motivation (6) Jobs? There are plenty of companies out there with in-house languages or that critically rely on compiler/interpreter expertise for other reasons. Some possibly surprising examples: Facebook Standard Chartered Bank Jane Street G53CMP: Lecture 1 p.9/39

37 Learning Outcomes Knowledge of language and compiler design, semantics, key ideas and techniques. Experience of compiler construction tools. Experience of working with a medium-sized program. Programming in various paradigms Capturing design through formal specifications and deriving implementations from those. G53CMP: Lecture 1 p.10/39

38 Literature (1) David A. Watt and Deryck F. Brown. Programming Language Processors in Java, Prentice-Hall, Used to be the main book. The lectures partly follow the structure of this book. G53CMP: Lecture 1 p.11/39

39 Literature (1) David A. Watt and Deryck F. Brown. Programming Language Processors in Java, Prentice-Hall, Used to be the main book. The lectures partly follow the structure of this book. The coursework was originally based on it. G53CMP: Lecture 1 p.11/39

40 Literature (1) David A. Watt and Deryck F. Brown. Programming Language Processors in Java, Prentice-Hall, Used to be the main book. The lectures partly follow the structure of this book. The coursework was originally based on it. Hands-on approach to compiler construction. Particularly good if you like Java. G53CMP: Lecture 1 p.11/39

41 Literature (1) David A. Watt and Deryck F. Brown. Programming Language Processors in Java, Prentice-Hall, Used to be the main book. The lectures partly follow the structure of this book. The coursework was originally based on it. Hands-on approach to compiler construction. Particularly good if you like Java. Considers software engineering aspects. G53CMP: Lecture 1 p.11/39

42 Literature (1) David A. Watt and Deryck F. Brown. Programming Language Processors in Java, Prentice-Hall, Used to be the main book. The lectures partly follow the structure of this book. The coursework was originally based on it. Hands-on approach to compiler construction. Particularly good if you like Java. Considers software engineering aspects. A bit weak on linking theory with practice. G53CMP: Lecture 1 p.11/39

43 Literature (2) An alternative: Keith D. Cooper and Linda Torczon. Engineering a Compiler, Elsevier, Covers more ground in greater depth than this module. G53CMP: Lecture 1 p.12/39

44 Literature (2) An alternative: Keith D. Cooper and Linda Torczon. Engineering a Compiler, Elsevier, Covers more ground in greater depth than this module. Gradually becoming the new main reference for the module. G53CMP: Lecture 1 p.12/39

45 Literature (2) An alternative: Keith D. Cooper and Linda Torczon. Engineering a Compiler, Elsevier, Covers more ground in greater depth than this module. Gradually becoming the new main reference for the module. For each lecture, there are references to the relevant chapter(s) of both books (see lecture overview on the G53CMP web page). G53CMP: Lecture 1 p.12/39

46 Literature (3) Great supplement: Alfred V Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers Principles, Techniques, and Tools, Addison-Wesley, (The Dragon Book.) Classic reference in the field. G53CMP: Lecture 1 p.13/39

47 Literature (3) Great supplement: Alfred V Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers Principles, Techniques, and Tools, Addison-Wesley, (The Dragon Book.) Classic reference in the field. Covers much more ground in greater depth than this module. G53CMP: Lecture 1 p.13/39

48 Literature (3) Great supplement: Alfred V Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers Principles, Techniques, and Tools, Addison-Wesley, (The Dragon Book.) Classic reference in the field. Covers much more ground in greater depth than this module. A book that will last for years. G53CMP: Lecture 1 p.13/39

49 Literature (3) Great supplement: Alfred V Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers Principles, Techniques, and Tools, Addison-Wesley, (The Dragon Book.) Classic reference in the field. Covers much more ground in greater depth than this module. A book that will last for years. There is a New(-ish) 2007 edition! G53CMP: Lecture 1 p.13/39

50 Literature (3) Great supplement: Alfred V Aho, Ravi Sethi, Jeffrey D. Ullman. Compilers Principles, Techniques, and Tools, Addison-Wesley, (The Dragon Book.) Classic reference in the field. Covers much more ground in greater depth than this module. A book that will last for years. There is a New(-ish) 2007 edition! But nice that core principles have lasting value! G53CMP: Lecture 1 p.13/39

51 Literature (4) Other useful references: Benjamin C. Pierce. Types and Programming Languages. Graham Hutton. Programming in Haskell. G53CMP: Lecture 1 p.14/39

52 Lectures and Handouts Come prepared to take notes. There will be some handouts, but for the most part not. G53CMP: Lecture 1 p.15/39

53 Lectures and Handouts Come prepared to take notes. There will be some handouts, but for the most part not. All electronic slides, program code, and other supporting material in electronic form used during the lectures, will be made available on the course web page. G53CMP: Lecture 1 p.15/39

54 Lectures and Handouts Come prepared to take notes. There will be some handouts, but for the most part not. All electronic slides, program code, and other supporting material in electronic form used during the lectures, will be made available on the course web page. However! The electronic record of the lectures is neither guaranteed to be complete nor self-contained! G53CMP: Lecture 1 p.15/39

55 Assessment (1) First sit: The exam counts for 75 % of the total mark. The coursework counts for the remaining 25 %. 2 h exam, 3 questions, each worth 25 %. G53CMP: Lecture 1 p.16/39

56 Assessment (1) First sit: The exam counts for 75 % of the total mark. The coursework counts for the remaining 25 %. 2 h exam, 3 questions, each worth 25 %. Bonus! There will be (sub)question(s) on the exam closely related to the coursework! Effectively, the weight of the coursework is thus more like 50 %, except partly examined later. G53CMP: Lecture 1 p.16/39

57 Assessment (2) Resit: The exam counts for 100 % of the total mark. 2 h exam, 4 questions, each worth 25 % The coursework does not count. G53CMP: Lecture 1 p.17/39

58 Assessment (3) Why this structure? G53CMP: Lecture 1 p.18/39

59 Assessment (3) Why this structure? Compiler construction is best learnt by doing. G53CMP: Lecture 1 p.18/39

60 Assessment (3) Why this structure? Compiler construction is best learnt by doing. Thus, if you do and understand the coursework, you will be handsomely rewarded. G53CMP: Lecture 1 p.18/39

61 Assessment (3) Why this structure? Compiler construction is best learnt by doing. Thus, if you do and understand the coursework, you will be handsomely rewarded. Past experience shows that students who don t engage with the coursework struggle to pass. G53CMP: Lecture 1 p.18/39

62 Assessment (3) Why this structure? Compiler construction is best learnt by doing. Thus, if you do and understand the coursework, you will be handsomely rewarded. Past experience shows that students who don t engage with the coursework struggle to pass. 2013/14, half of the G53CMP students got 1st or II-1 marks... G53CMP: Lecture 1 p.18/39

63 Assessment (3) Why this structure? Compiler construction is best learnt by doing. Thus, if you do and understand the coursework, you will be handsomely rewarded. Past experience shows that students who don t engage with the coursework struggle to pass. 2013/14, half of the G53CMP students got 1st or II-1 marks... but a quarter failed. Clear correlation to coursework engagement. G53CMP: Lecture 1 p.18/39

64 Assessment (3) Why this structure? Compiler construction is best learnt by doing. Thus, if you do and understand the coursework, you will be handsomely rewarded. Past experience shows that students who don t engage with the coursework struggle to pass. 2013/14, half of the G53CMP students got 1st or II-1 marks... but a quarter failed. Clear correlation to coursework engagement. Numbers differ, but similar pattern most years. G53CMP: Lecture 1 p.18/39

65 Coursework (1) Learning goals: Getting a practical understanding of key concepts and techniques in the fields of compiler construction and language theory. G53CMP: Lecture 1 p.19/39

66 Coursework (1) Learning goals: Getting a practical understanding of key concepts and techniques in the fields of compiler construction and language theory. Getting hands-on experience of working with language processors. G53CMP: Lecture 1 p.19/39

67 Coursework (1) Learning goals: Getting a practical understanding of key concepts and techniques in the fields of compiler construction and language theory. Getting hands-on experience of working with language processors. Getting some experience of using compiler construction tools. G53CMP: Lecture 1 p.19/39

68 Coursework (1) Learning goals: Getting a practical understanding of key concepts and techniques in the fields of compiler construction and language theory. Getting hands-on experience of working with language processors. Getting some experience of using compiler construction tools. Getting experience of the issues involved in working with medium-sized programs. G53CMP: Lecture 1 p.19/39

69 Coursework (2) You will be given partial implementations of a compiler for a small language called MiniTrinagle. You will be asked to: G53CMP: Lecture 1 p.20/39

70 Coursework (2) You will be given partial implementations of a compiler for a small language called MiniTrinagle. You will be asked to: answer theoretical questions related to the code G53CMP: Lecture 1 p.20/39

71 Coursework (2) You will be given partial implementations of a compiler for a small language called MiniTrinagle. You will be asked to: answer theoretical questions related to the code extend the code with new features. G53CMP: Lecture 1 p.20/39

72 Coursework (2) You will be given partial implementations of a compiler for a small language called MiniTrinagle. You will be asked to: answer theoretical questions related to the code extend the code with new features. Detailed instructions for the coursework available (soon) from the module web page (Part I: 6 Oct.). G53CMP: Lecture 1 p.20/39

73 Coursework (2) You will be given partial implementations of a compiler for a small language called MiniTrinagle. You will be asked to: answer theoretical questions related to the code extend the code with new features. Detailed instructions for the coursework available (soon) from the module web page (Part I: 6 Oct.). Study these instructions very carefully! G53CMP: Lecture 1 p.20/39

74 Haskell and Coursework Support (1) The functional language Haskell is used throughout the module as: G53CMP: Lecture 1 p.21/39

75 Haskell and Coursework Support (1) The functional language Haskell is used throughout the module as: An ideal language for illustrating and discussing all aspects of compiler construction (and similar applications). G53CMP: Lecture 1 p.21/39

76 Haskell and Coursework Support (1) The functional language Haskell is used throughout the module as: An ideal language for illustrating and discussing all aspects of compiler construction (and similar applications). Functional language notation is closely aligned with mathematical notation and formalisms (such as attribute grammars) commonly used in text books on compilers. G53CMP: Lecture 1 p.21/39

77 Haskell and Coursework Support (1) The functional language Haskell is used throughout the module as: An ideal language for illustrating and discussing all aspects of compiler construction (and similar applications). Functional language notation is closely aligned with mathematical notation and formalisms (such as attribute grammars) commonly used in text books on compilers. A really good choice for implementing compilers in practice (and much else beside). G53CMP: Lecture 1 p.21/39

78 Haskell and Coursework Support (2) To help you get up to speed using Haskell and provide some extra help with the coursework: G53CMP: Lecture 1 p.22/39

79 Haskell and Coursework Support (2) To help you get up to speed using Haskell and provide some extra help with the coursework: Some of the lectures closely aligned with the coursework. G53CMP: Lecture 1 p.22/39

80 Haskell and Coursework Support (2) To help you get up to speed using Haskell and provide some extra help with the coursework: Some of the lectures closely aligned with the coursework. Haskell revision coursework (unassessed). G53CMP: Lecture 1 p.22/39

81 Haskell and Coursework Support (2) To help you get up to speed using Haskell and provide some extra help with the coursework: Some of the lectures closely aligned with the coursework. Haskell revision coursework (unassessed). Slides from a Haskell revision lecture via module web page. G53CMP: Lecture 1 p.22/39

82 Laboratory Sessions Laboratory sessions: Fridays, 9 11, A32 G53CMP: Lecture 1 p.23/39

83 Laboratory Sessions Laboratory sessions: Fridays, 9 11, A32 TAs will be present during the laboratory sessions from 7 October (except possibly 21 October). G53CMP: Lecture 1 p.23/39

84 Coursework Assessment (1) Two parts to the coursework: I and II G53CMP: Lecture 1 p.24/39

85 Coursework Assessment (1) Two parts to the coursework: I and II Each part to be solved individually G53CMP: Lecture 1 p.24/39

86 Coursework Assessment (1) Two parts to the coursework: I and II Each part to be solved individually Submission for each part: - Brief written report (hard copy & PDF) - All source code (electronically) G53CMP: Lecture 1 p.24/39

87 Coursework Assessment (1) Two parts to the coursework: I and II Each part to be solved individually Submission for each part: - Brief written report (hard copy & PDF) - All source code (electronically) For part II, compulsory 10 minute oral examination in assigned slot during one of the lab sessions after the submission deadline. G53CMP: Lecture 1 p.24/39

88 Coursework Assessment (1) Two parts to the coursework: I and II Each part to be solved individually Submission for each part: - Brief written report (hard copy & PDF) - All source code (electronically) For part II, compulsory 10 minute oral examination in assigned slot during one of the lab sessions after the submission deadline. Catch-up slots only if missed slot with good cause; personal tutor to request on your behalf. G53CMP: Lecture 1 p.24/39

89 Coursework Assessment (2) G53CMP: Lecture 1 p.25/39

90 Coursework Assessment (2) A number of weighted questions for each. part G53CMP: Lecture 1 p.25/39

91 Coursework Assessment (2) A number of weighted questions for each. part Written answer to each question assessed on - Correctness (0, 1, or 2 marks) - Style (0, 1, or 2 marks) G53CMP: Lecture 1 p.25/39

92 Coursework Assessment (2) A number of weighted questions for each. part Written answer to each question assessed on - Correctness (0, 1, or 2 marks) - Style (0, 1, or 2 marks) In the oral examination (part II only), you explain your answers. G53CMP: Lecture 1 p.25/39

93 Coursework Assessment (2) A number of weighted questions for each. part Written answer to each question assessed on - Correctness (0, 1, or 2 marks) - Style (0, 1, or 2 marks) In the oral examination (part II only), you explain your answers. Your explanations are assessed as follows: - 2: 100 % of mark for written answer - 1: 65 % of mark for written answer - 0: 0 % of mark for written answer G53CMP: Lecture 1 p.25/39

94 Coursework Deadlines Coursework deadlines: Part I: Monday 31 October, 15:00. Part II: Monday 28 November, 15:00. G53CMP: Lecture 1 p.26/39

95 Coursework Deadlines Coursework deadlines: Part I: Monday 31 October, 15:00. Part II: Monday 28 November, 15:00. Oral examinations during the lab sessions the following two Fridays; i.e. 2 and 9 December. G53CMP: Lecture 1 p.26/39

96 Coursework Deadlines Coursework deadlines: Part I: Monday 31 October, 15:00. Part II: Monday 28 November, 15:00. Oral examinations during the lab sessions the following two Fridays; i.e. 2 and 9 December. Start early! It is not possible to do this coursework at the last minute. G53CMP: Lecture 1 p.26/39

97 What is a Compiler? (1) Compilers are program translators: source program compiler target program error diagnostics Typical example: Source language: C Target language: x86 assembler G53CMP: Lecture 1 p.27/39

98 What is a Compiler? (1) Compilers are program translators: source program compiler target program error diagnostics Typical example: Source language: C Target language: x86 assembler Why? To make it easier to program computers! G53CMP: Lecture 1 p.27/39

99 What is a Compiler? (2) GCC translates this C program int main(int argc, char *argv) { printf("%d\n", argc - 1); } into this x86 assembly code (excerpt): movl decl subl pushl pushl call 8(%ebp), %eax %eax $8, %esp %eax $.LC0 printf addl $16, %esp G53CMP: Lecture 1 p.28/39

100 Source and Target Languages Large spectrum of possibilities, for example: Source languages: - (High-level) programming languages - Modelling languages - Document description languages - Database query languages G53CMP: Lecture 1 p.29/39

101 Source and Target Languages Large spectrum of possibilities, for example: Source languages: - (High-level) programming languages - Modelling languages - Document description languages - Database query languages Target languages: - High-level programming language - Low-level programming language (assembler or machine code, byte code) G53CMP: Lecture 1 p.29/39

102 Where are Compilers Used? (1) Implementation of programming languages: C, C++, Java, C#, Haskell, Lisp, Prolog, Ada, Fortran, Cobol,... G53CMP: Lecture 1 p.30/39

103 Where are Compilers Used? (1) Implementation of programming languages: C, C++, Java, C#, Haskell, Lisp, Prolog, Ada, Fortran, Cobol,... Document processing: LaTeX DVI, DVI PostScript/PDF/... G53CMP: Lecture 1 p.30/39

104 Where are Compilers Used? (1) Implementation of programming languages: C, C++, Java, C#, Haskell, Lisp, Prolog, Ada, Fortran, Cobol,... Document processing: LaTeX DVI, DVI PostScript/PDF/... Databases: optimization of database queries expressed in query languages like SQL. G53CMP: Lecture 1 p.30/39

105 Where are Compilers Used? (2) Hardware design: modelling and simulation/verification, compilation to silicon. E.g. Spice, VHDL. G53CMP: Lecture 1 p.31/39

106 Where are Compilers Used? (2) Hardware design: modelling and simulation/verification, compilation to silicon. E.g. Spice, VHDL. Modelling and simulation of physical systems (cars, trains, aircraft, nuclear power plants,... ): Simulink, Modelica. G53CMP: Lecture 1 p.31/39

107 Where are Compilers Used? (2) Hardware design: modelling and simulation/verification, compilation to silicon. E.g. Spice, VHDL. Modelling and simulation of physical systems (cars, trains, aircraft, nuclear power plants,... ): Simulink, Modelica. In Web browsers to speed up execution of code embedded in web pages, applets, Rich Internet Applications (RIA), etc. G53CMP: Lecture 1 p.31/39

108 Where are Compilers Used? (2) Hardware design: modelling and simulation/verification, compilation to silicon. E.g. Spice, VHDL. Modelling and simulation of physical systems (cars, trains, aircraft, nuclear power plants,... ): Simulink, Modelica. In Web browsers to speed up execution of code embedded in web pages, applets, Rich Internet Applications (RIA), etc.... G53CMP: Lecture 1 p.31/39

109 Compilers vs. Interpreters Interpreters are another class of translators: Compiler: translates a program once and for all into target language. G53CMP: Lecture 1 p.32/39

110 Compilers vs. Interpreters Interpreters are another class of translators: Compiler: translates a program once and for all into target language. Interpreter: effectively translates (the used parts of) a source program every time it is run. G53CMP: Lecture 1 p.32/39

111 Compilers vs. Interpreters Interpreters are another class of translators: Compiler: translates a program once and for all into target language. Interpreter: effectively translates (the used parts of) a source program every time it is run. Techniques like Just-In-Time Compilation (JIT) blurs this distinction. G53CMP: Lecture 1 p.32/39

112 Compilers vs. Interpreters Interpreters are another class of translators: Compiler: translates a program once and for all into target language. Interpreter: effectively translates (the used parts of) a source program every time it is run. Techniques like Just-In-Time Compilation (JIT) blurs this distinction. Compilers and interpreters sometimes used together, e.g. Java: Java compiled into Java byte code, byte code interpreted by a Java Virtual Machine (JVM), JVM might use JIT. G53CMP: Lecture 1 p.32/39

113 Inside the Compiler (1) Traditionally, a compiler is broken down into several phases: Scanner: lexical analysis Parser: syntactic analysis Checker: contextual analysys (e.g. type checking) Optimizer: code improvement Code generator G53CMP: Lecture 1 p.33/39

114 Inside the Compiler (2) Lexical Analysis: G53CMP: Lecture 1 p.34/39

115 Inside the Compiler (2) Lexical Analysis: - Verify that input character sequence is lexically valid. G53CMP: Lecture 1 p.34/39

116 Inside the Compiler (2) Lexical Analysis: - Verify that input character sequence is lexically valid. - Group characters into sequence of lexical symbols, tokens. G53CMP: Lecture 1 p.34/39

117 Inside the Compiler (2) Lexical Analysis: - Verify that input character sequence is lexically valid. - Group characters into sequence of lexical symbols, tokens. - Discard white space and comments (typically). G53CMP: Lecture 1 p.34/39

118 Inside the Compiler (3) Syntactic Analysis/Parsing G53CMP: Lecture 1 p.35/39

119 Inside the Compiler (3) Syntactic Analysis/Parsing - Verify that the input program is syntactically valid, i.e. conforms to the Context Free Grammar of the language. G53CMP: Lecture 1 p.35/39

120 Inside the Compiler (3) Syntactic Analysis/Parsing - Verify that the input program is syntactically valid, i.e. conforms to the Context Free Grammar of the language. - Determine the program structure. G53CMP: Lecture 1 p.35/39

121 Inside the Compiler (3) Syntactic Analysis/Parsing - Verify that the input program is syntactically valid, i.e. conforms to the Context Free Grammar of the language. - Determine the program structure. - Construct a representation of the program reflecting that structure without unnecessary details, usually an Abstract Syntax Tree (AST). G53CMP: Lecture 1 p.35/39

122 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: G53CMP: Lecture 1 p.36/39

123 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. G53CMP: Lecture 1 p.36/39

124 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. - Report undefined symbols. G53CMP: Lecture 1 p.36/39

125 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. - Report undefined symbols. - Type checking G53CMP: Lecture 1 p.36/39

126 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. - Report undefined symbols. - Type checking Optimization: G53CMP: Lecture 1 p.36/39

127 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. - Report undefined symbols. - Type checking Optimization: - Code improvements aiming at making it run faster and/or use less space, energy, etc. G53CMP: Lecture 1 p.36/39

128 Inside the Compiler (4) Contextual Analysis/Checking Static Semantics: - Resolve meaning of symbols. - Report undefined symbols. - Type checking Optimization: - Code improvements aiming at making it run faster and/or use less space, energy, etc. - Almost always heuristics: cannot guarantee optimal result. G53CMP: Lecture 1 p.36/39

129 Inside the Compiler (5) Code Generation: G53CMP: Lecture 1 p.37/39

130 Inside the Compiler (5) Code Generation: - Output the appropriate sequence of target language instructions. G53CMP: Lecture 1 p.37/39

131 Inside the Compiler (5) Code Generation: - Output the appropriate sequence of target language instructions. - Might involve further low-level (target-specific) optimization. G53CMP: Lecture 1 p.37/39

132 Inside the Compiler (6) sequence of characters scanner Lexical Analysis sequence of tokens parser Syntactic Analysis/Parsing Abstract Syntax Tree (AST) checker Contextual Analysis/checking Static Semantics (e.g. Type Checking) Intermediate Representation (IR), e.g. verified/annotated AST optimizer/ code generator Optimization and Code Generation (possibly many steps involving a number of intermediary representations) target code G53CMP: Lecture 1 p.38/39

133 Inside the Compiler (7) Front end: Scanner, Parser, Contextual checker. Depends more heavily on the source language. G53CMP: Lecture 1 p.39/39

134 Inside the Compiler (7) Front end: Scanner, Parser, Contextual checker. Depends more heavily on the source language. Middle section ( Middle end ): Optimizer. Operates on an Intermediary Representation (IR) that could be fairly independent of source and target language. Hence potentially reusable! G53CMP: Lecture 1 p.39/39

135 Inside the Compiler (7) Front end: Scanner, Parser, Contextual checker. Depends more heavily on the source language. Middle section ( Middle end ): Optimizer. Operates on an Intermediary Representation (IR) that could be fairly independent of source and target language. Hence potentially reusable! Back end: Code Generator Depends heavily on the target language. G53CMP: Lecture 1 p.39/39

Finding People and Information (1) G53CMP: Lecture 1. Aims and Motivation (1) Finding People and Information (2)

Finding People and Information (1) G53CMP: Lecture 1. Aims and Motivation (1) Finding People and Information (2) Finding People and Information (1) G53CMP: Lecture 1 Administrative Details 2017 and Introduction to Compiler Construction Henrik Nilsson Henrik Nilsson Room A08, Computer Science Building e-mail: nhn@cs.nott.ac.uk

More information

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus

Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008. Course Syllabus Philadelphia University Faculty of Information Technology Department of Computer Science --- Semester, 2007/2008 Course Syllabus Course Title: Compiler Construction Course Level: 4 Lecture Time: Course

More information

Compiler Construction LECTURE # 1

Compiler Construction LECTURE # 1 Compiler Construction AN OVERVIEW LECTURE # 1 The Course Course Code: CS-4141 Course Title: Compiler Construction Instructor: JAWAD AHMAD Email Address: jawadahmad@uoslahore.edu.pk Web Address: http://csandituoslahore.weebly.com/cc.html

More information

COMP 3002: Compiler Construction. Pat Morin School of Computer Science

COMP 3002: Compiler Construction. Pat Morin School of Computer Science COMP 3002: Compiler Construction Pat Morin School of Computer Science Course Information Instructor: Pat Morin morin@scs.carleton.ca Just "Pat" Office Hours: Tuesdays 9:00-10:00, 13:30-14:30 Webpage: http://cg.scs.carleton.ca/~morin/teaching/3002/

More information

Recap: Typical Compiler Structure. G53CMP: Lecture 2 A Complete (Albeit Small) Compiler. This Lecture (2) This Lecture (1)

Recap: Typical Compiler Structure. G53CMP: Lecture 2 A Complete (Albeit Small) Compiler. This Lecture (2) This Lecture (1) Recap: Typical Compiler Structure G53CMP: Lecture 2 A Complete (Albeit Small) Compiler Henrik Nilsson Front End sequence of characters scanner Lexical Analysis sequence of tokens parser Syntactic Analysis/Parsing

More information

Compiling Techniques

Compiling Techniques Lecture 1: Introduction 20 September 2016 Table of contents 1 2 3 Essential Facts Lecturer: (christophe.dubach@ed.ac.uk) Office hours: Thursdays 11am-12pm Textbook (not strictly required): Keith Cooper

More information

Compiler Design. Dr. Chengwei Lei CEECS California State University, Bakersfield

Compiler Design. Dr. Chengwei Lei CEECS California State University, Bakersfield Compiler Design Dr. Chengwei Lei CEECS California State University, Bakersfield The course Instructor: Dr. Chengwei Lei Office: Science III 339 Office Hours: M/T/W 1:00-1:59 PM, or by appointment Phone:

More information

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers Leonidas Fegaras CSE 5317/4305 L1: Course Organization and Introduction 1 General Course Information Instructor:

More information

CS 536. Class Meets. Introduction to Programming Languages and Compilers. Instructor. Key Dates. Teaching Assistant. Charles N. Fischer.

CS 536. Class Meets. Introduction to Programming Languages and Compilers. Instructor. Key Dates. Teaching Assistant. Charles N. Fischer. CS 536 Class Meets Introduction to Programming Languages and Compilers Mondays, Wednesdays & Fridays, 11:00 11:50 204 Educational Sciences Charles N. Fischer Instructor Fall 2012 http://www.cs.wisc.edu/~fischer/cs536.html

More information

CS415 Compilers Overview of the Course. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University

CS415 Compilers Overview of the Course. These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University CS415 Compilers Overview of the Course These slides are based on slides copyrighted by Keith Cooper, Ken Kennedy & Linda Torczon at Rice University Critical Facts Welcome to CS415 Compilers Topics in the

More information

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers Leonidas Fegaras CSE 5317/4305 L1: Course Organization and Introduction 1 General Course Information Instructor:

More information

CST-402(T): Language Processors

CST-402(T): Language Processors CST-402(T): Language Processors Course Outcomes: On successful completion of the course, students will be able to: 1. Exhibit role of various phases of compilation, with understanding of types of grammars

More information

Formal Languages and Compilers Lecture I: Introduction to Compilers

Formal Languages and Compilers Lecture I: Introduction to Compilers Formal Languages and Compilers Lecture I: Introduction to Compilers Free University of Bozen-Bolzano Faculty of Computer Science POS Building, Room: 2.03 artale@inf.unibz.it http://www.inf.unibz.it/ artale/

More information

CS Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0

CS Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0 SYL-410-2014C CS 410 - Compiler Construction West Virginia fall semester 2014 August 18, 2014 syllabus 1.0 Course location: 107 ERB, Evansdale Campus Course times: Tuesdays and Thursdays, 2:00-3:15 Course

More information

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY

G.PULLAIH COLLEGE OF ENGINEERING & TECHNOLOGY G.PULLAI COLLEGE OF ENGINEERING & TECNOLOGY Nandikotkur Road, Kurnool 518002 DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING Semester VI (2017-2018) COURSE DESCRIPTION Course Code : 15A05601 Course Title

More information

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective CS 432 Fall 2017 Mike Lam, Professor Compilers Advanced Systems Elective Discussion question What is a compiler? Automated translation A compiler is a computer program that automatically translates other

More information

General Course Information. Catalogue Description. Objectives

General Course Information. Catalogue Description. Objectives General Course Information CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers Instructor: Leonidas Fegaras Office: ERB 653 (Engineering Research Bldg) Phone: (817)

More information

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers

CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers CSE4305: Compilers for Algorithmic Languages CSE5317: Design and Construction of Compilers Leonidas Fegaras CSE 5317/4305 L1: Course Organization and Introduction 1 General Course Information Instructor:

More information

CS 4120 and 5120 are really the same course. CS 4121 (5121) is required! Outline CS 4120 / 4121 CS 5120/ = 5 & 0 = 1. Course Information

CS 4120 and 5120 are really the same course. CS 4121 (5121) is required! Outline CS 4120 / 4121 CS 5120/ = 5 & 0 = 1. Course Information CS 4120 / 4121 CS 5120/5121 Introduction to Compilers Fall 2011 Andrew Myers Lecture 1: Overview Outline About this course Introduction to compilers What are compilers? Why should we learn about them?

More information

Compiler construction

Compiler construction Compiler construction Martin Steffen January 16, 2017 Contents 1 Abstract 1 1.1 Introduction............................................... 1 1.1.1 Introduction..........................................

More information

Introduction to Compilers and Language Design Copyright (C) 2017 Douglas Thain. All rights reserved.

Introduction to Compilers and Language Design Copyright (C) 2017 Douglas Thain. All rights reserved. Introduction to Compilers and Language Design Copyright (C) 2017 Douglas Thain. All rights reserved. Anyone is free to download and print the PDF edition of this book for personal use. Commercial distribution,

More information

Compilers Crash Course

Compilers Crash Course Compilers Crash Course Prof. Michael Clarkson CSci 6907.85 Spring 2014 Slides Acknowledgment: Prof. Andrew Myers (Cornell) What are Compilers? Translators from one representation of program code to another

More information

Compiler Construction

Compiler Construction Compiler Construction WWW: http://www.cs.uu.nl/wiki/cco Contact: J.Hage@uu.nl Edition 2016/2017 Course overview 2 What is compiler construction about? Programs are usually written in a high-level programming

More information

Compilers. Prerequisites

Compilers. Prerequisites Compilers Prerequisites Data structures & algorithms Linked lists, dictionaries, trees, hash tables Formal languages & automata Regular expressions, finite automata, context-free grammars Machine organization

More information

Important Project Dates

Important Project Dates Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science 6.035, Fall 2002 Handout 4 Project Overview Wednesday, September 4 This is an overview of the course project

More information

12048 Compilers II. Computer Science Engineering, 8º semester Mandatory, 2º Cycle. Theoretical credits: 3.0 Lab credits: 1.5. Theory: José Neira

12048 Compilers II. Computer Science Engineering, 8º semester Mandatory, 2º Cycle. Theoretical credits: 3.0 Lab credits: 1.5. Theory: José Neira 12048 Compilers II Computer Science Engineering, 8º semester Mandatory, 2º Cycle Theoretical credits: 3.0 Lab credits: 1.5 Theory: José Neira Labs: David Ken Vallejo, Javier Fabra, Luis Carlos Gallego

More information

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006

C Compilation Model. Comp-206 : Introduction to Software Systems Lecture 9. Alexandre Denault Computer Science McGill University Fall 2006 C Compilation Model Comp-206 : Introduction to Software Systems Lecture 9 Alexandre Denault Computer Science McGill University Fall 2006 Midterm Date: Thursday, October 19th, 2006 Time: from 16h00 to 17h30

More information

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective

CS 432 Fall Mike Lam, Professor. Compilers. Advanced Systems Elective CS 432 Fall 2018 Mike Lam, Professor Compilers Advanced Systems Elective Discussion question What is a compiler? Automated translation A compiler is a computer program that automatically translates other

More information

INF5110 Compiler Construction

INF5110 Compiler Construction INF5110 Compiler Construction Introduction Spring 2016 1 / 33 Outline 1. Introduction Introduction Compiler architecture & phases Bootstrapping and cross-compilation 2 / 33 Outline 1. Introduction Introduction

More information

Earlier edition Dragon book has been revised. Course Outline Contact Room 124, tel , rvvliet(at)liacs(dot)nl

Earlier edition Dragon book has been revised. Course Outline Contact Room 124, tel , rvvliet(at)liacs(dot)nl Compilerconstructie najaar 2013 http://www.liacs.nl/home/rvvliet/coco/ Rudy van Vliet kamer 124 Snellius, tel. 071-527 5777 rvvliet(at)liacs(dot)nl college 1, dinsdag 3 september 2013 Overview 1 Why this

More information

Introduction to Compiler Construction

Introduction to Compiler Construction Introduction to Compiler Construction Robert van Engelen http://www.cs.fsu.edu/~engelen/courses/cop5621 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2007-2011 Syllabus

More information

Introduction to Compiler Construction

Introduction to Compiler Construction Introduction to Compiler Construction Robert van Engelen http://www.cs.fsu.edu/~engelen/courses/cop5621 COP5621 Compiler Construction Copyright Robert van Engelen, Florida State University, 2005 Syllabus

More information

ECE573 Introduction to Compilers & Translators

ECE573 Introduction to Compilers & Translators ECE573 Introduction to Compilers & Translators Tentative Syllabus Fall 2005 Tu/Th 9:00-10:15 AM, EE 115 Instructor Prof. R. Eigenmann Tel 49-41741 Email eigenman@ecn Office EE334C Office Hours Tu 10:15-11:30

More information

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented Course Goal CMSC 330: Organization of Programming Languages Introduction Learn how programming languages work Broaden your language horizons! Different programming languages! Different language features

More information

CA Compiler Construction

CA Compiler Construction CA4003 - Compiler Construction David Sinclair Overview This module will cover the compilation process, reading and parsing a structured language, storing it in an appropriate data structure, analysing

More information

CSEP 501 Compilers. Overview and Administrivia Hal Perkins Winter /8/ Hal Perkins & UW CSE A-1

CSEP 501 Compilers. Overview and Administrivia Hal Perkins Winter /8/ Hal Perkins & UW CSE A-1 CSEP 501 Compilers Overview and Administrivia Hal Perkins Winter 2008 1/8/2008 2002-08 Hal Perkins & UW CSE A-1 Credits Some direct ancestors of this course Cornell CS 412-3 (Teitelbaum, Perkins) Rice

More information

Compiler Theory Introduction and Course Outline Sandro Spina Department of Computer Science

Compiler Theory Introduction and Course Outline Sandro Spina Department of Computer Science Compiler Theory 001 - Introduction and Course Outline Sandro Spina Department of Computer Science ( course Books (needed during this My slides are based on the three books: Compilers: Principles, techniques

More information

understanding recursive data types, recursive functions to compute over them, and structural induction to prove things about them

understanding recursive data types, recursive functions to compute over them, and structural induction to prove things about them CS 555 Advanced Compiler Construction, Fall 2002 1 Course Information Course structure for Fall 2002 This semester the course will focus on compilation of functional programming languages. Important topics

More information

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTER SCIENCE AND ENGINEERING DEPARTMENT OF CSE COURSE PLAN Course Code : CS0301 Course Title : Compiler Design Semester : V Course Time

More information

Compiler Construction Principles And Practice Solution Manual

Compiler Construction Principles And Practice Solution Manual Compiler Construction Principles And Practice Solution Manual COMPILER CONSTRUCTION PRINCIPLES AND PRACTICE SOLUTION MANUAL PDF - Are you looking for compiler construction principles and practice solution

More information

CS/SE 153 Concepts of Compiler Design

CS/SE 153 Concepts of Compiler Design San José State University Department of Computer Science CS/SE 153 Concepts of Compiler Design Course and Contact Information Instructor: Ron Mak Office Location: ENG 250 Email: Website: Office Hours:

More information

CS 236 Language and Computation

CS 236 Language and Computation CS 236 Language and Computation Course Notes Chapt. 1: Introduction Anton Setzer (Based on a book draft by J. V. Tucker and K. Stephenson) Dept. of Computer Science, Swansea University http://www.cs.swan.ac.uk/

More information

History of Compilers The term

History of Compilers The term History of Compilers The term compiler was coined in the early 1950s by Grace Murray Hopper. Translation was viewed as the compilation of a sequence of machine-language subprograms selected from a library.

More information

CSCI 565 Compiler Design and Implementation Spring 2014

CSCI 565 Compiler Design and Implementation Spring 2014 CSCI 565 Compiler Design and Implementation Spring 2014 Instructor: Description: Prerequisites: Dr. Pedro C. Diniz, e-mail pedro@isi.edu Lectures: Thursday, 8.00 10.50 AM, RTH 217, phone: (213) 740 4518

More information

DOID: A Lexical Analyzer for Understanding Mid-Level Compilation Processes

DOID: A Lexical Analyzer for Understanding Mid-Level Compilation Processes www.ijecs.in International Journal Of Engineering And Computer Science ISSN: 2319-7242 Volume 5 Issue 12 Dec. 2016, Page No. 19507-19511 DOID: A Lexical Analyzer for Understanding Mid-Level Compilation

More information

Compilers and computer architecture: introduction

Compilers and computer architecture: introduction 1 / 41 Compilers and computer architecture: introduction Martin Berger September 2018 2 / 41 Administrative matters: lecturer Name: Martin Berger Email: M.F.Berger@sussex.ac.uk Web: http://users.sussex.ac.uk/~mfb21/compilers

More information

Compilers for Modern Architectures Course Syllabus, Spring 2015

Compilers for Modern Architectures Course Syllabus, Spring 2015 Compilers for Modern Architectures Course Syllabus, Spring 2015 Instructor: Dr. Rafael Ubal Email: ubal@ece.neu.edu Office: 140 The Fenway, 3rd floor (see detailed directions below) Phone: 617-373-3895

More information

CS131: Programming Languages and Compilers. Spring 2017

CS131: Programming Languages and Compilers. Spring 2017 CS131: Programming Languages and Compilers Spring 2017 Course Information Instructor: Fu Song Office: Room 1A-504C, SIST Building Email: songfu@shanghaitech.edu.cn Class Hours : Tuesday and Thursday, 8:15--9:55

More information

CS 314 Principles of Programming Languages

CS 314 Principles of Programming Languages CS 314 Principles of Programming Languages Lecture 1: Overview and Basics Zheng (Eddy) Zhang Rutgers University January 17th, 2018 Course Goals To gain understanding of the basic structure of programming

More information

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10

INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES. Norbert Zeh Winter Dalhousie University 1/10 INTRODUCTION PRINCIPLES OF PROGRAMMING LANGUAGES Norbert Zeh Winter 2018 Dalhousie University 1/10 GOAL OF THIS COURSE 2/10 GOAL OF THIS COURSE Encourage you to become better programmers 2/10 GOAL OF THIS

More information

Working of the Compilers

Working of the Compilers Working of the Compilers Manisha Yadav Nisha Thakran IT DEPARTMENT IT DEPARTMENT DCE,GURGAON DCE,GURGAON Abstract- The objective of the paper is to depict the working of the compilers that were designed

More information

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University

CS383 PROGRAMMING LANGUAGES. Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University CS383 PROGRAMMING LANGUAGES Kenny Q. Zhu Dept. of Computer Science Shanghai Jiao Tong University KENNY Q. ZHU Research Interests: Programming Languages Probabilistic Programming Data Processing Concurrency

More information

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing

What Is Computer Science? The Scientific Study of Computation. Expressing or Describing What Is Computer Science? The Scientific Study of Computation CMPSCI 630: Programming Languages Introduction Spring 2009 (with thanks to Robert Harper) Expressing or Describing Automating Understanding

More information

CSE 504: Compiler Design

CSE 504: Compiler Design http://xkcd.com/303/ Compiler Design Course Organization CSE 504 1 / 20 CSE 504: Compiler Design http://www.cs.stonybrook.edu/~cse504/ Mon., Wed. 2:30pm 3:50pm Harriman Hall 116 C. R. Ramakrishnan e-mail:

More information

SOFTWARE ENGINEERING

SOFTWARE ENGINEERING SOFTWARE ENGINEERING INTRODUCTION TO SOFTWARE ENGINEERING. COURSE STRUCTURE AND REQUIREMENTS Saulius Ragaišis saulius.ragaisis@mif.vu.lt WHAT IS SOFTWARE ENGINEERING? First definition Software engineering

More information

CMPE 152 Compiler Design

CMPE 152 Compiler Design San José State University Department of Computer Engineering CMPE 152 Compiler Design Course and contact information Instructor: Ron Mak Office Location: ENG 250 Email: Website: Office Hours: Section 4

More information

CSE 582 Autumn 2002 Exam 11/26/02

CSE 582 Autumn 2002 Exam 11/26/02 Name There are 8 questions worth a total of 100 points. Please budget your time so you get to all of the questions. Keep your answers brief and to the point. You may refer to the following reference materials:

More information

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN

SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN Course Code : CS0301 Course Title : Compiler Design Semester : V Course Time : July Dec 2011 DAY SRM UNIVERSITY FACULTY OF ENGINEERING AND TECHNOLOGY SCHOOL OF COMPUTING DEPARTMENT OF CSE COURSE PLAN SECTION

More information

G52LAC Languages and Computation Lecture 6

G52LAC Languages and Computation Lecture 6 G52LAC Languages and Computation Lecture 6 Equivalence of Regular Expression and Finite Automata Henrik Nilsson University of Nottingham G52LACLanguages and ComputationLecture 6 p.1/28 This Lecture (1)

More information

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview

COMP 181 Compilers. Administrative. Last time. Prelude. Compilation strategy. Translation strategy. Lecture 2 Overview COMP 181 Compilers Lecture 2 Overview September 7, 2006 Administrative Book? Hopefully: Compilers by Aho, Lam, Sethi, Ullman Mailing list Handouts? Programming assignments For next time, write a hello,

More information

ST. XAVIER S COLLEGE

ST. XAVIER S COLLEGE ST. XAVIER S COLLEGE MAITIGHAR, KATHMANDU Compiler Design and Construction Lab Assignment #1 Submitted by: Aashish Raj Shrestha 013BSCCSIT002 Submitted to: Mr. Ramesh Shahi Lecturer, Department of Computer

More information

Compiler Construction 2010 (6 credits)

Compiler Construction 2010 (6 credits) http://lara.epfl.ch Drawing Hands M.C. Escher, 1948 Compiler Construction 2010 (6 credits) Staff: Viktor Kuncak Lectures Hossein Hojjat Exercises Philippe Suter {labs} Étienne Kneuss, Ali Sinan Köksal

More information

Concepts of Programming Languages

Concepts of Programming Languages Concepts of Programming Languages Lecture 1 - Introduction Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages Spring 2014

More information

SOFTWARE ENGINEERING

SOFTWARE ENGINEERING SOFTWARE ENGINEERING INTRODUCTION TO SOFTWARE ENGINEERING. COURSE STRUCTURE AND REQUIREMENTS Saulius Ragaišis saulius.ragaisis@mif.vu.lt WHAT IS SOFTWARE ENGINEERING? First definition Software engineering

More information

INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM

INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM INCORPORATING ADVANCED PROGRAMMING TECHNIQUES IN THE COMPUTER INFORMATION SYSTEMS CURRICULUM Charles S. Saxon, Eastern Michigan University, charles.saxon@emich.edu ABSTRACT Incorporating advanced programming

More information

CMPE 152 Compiler Design

CMPE 152 Compiler Design San José State University Department of Computer Engineering CMPE 152 Compiler Design Section 1 (Class) Sections 2 and 3 (s) Fall 2018 Course and Contact Information Instructor: Ron Mak Office Location:

More information

Compilers and Interpreters

Compilers and Interpreters Overview Roadmap Language Translators: Interpreters & Compilers Context of a compiler Phases of a compiler Compiler Construction tools Terminology How related to other CS Goals of a good compiler 1 Compilers

More information

Compiler Design (40-414)

Compiler Design (40-414) Compiler Design (40-414) Main Text Book: Compilers: Principles, Techniques & Tools, 2 nd ed., Aho, Lam, Sethi, and Ullman, 2007 Evaluation: Midterm Exam 35% Final Exam 35% Assignments and Quizzes 10% Project

More information

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful?

Why are there so many programming languages? Why do we have programming languages? What is a language for? What makes a language successful? Chapter 1 :: Introduction Introduction Programming Language Pragmatics Michael L. Scott Why are there so many programming languages? evolution -- we've learned better ways of doing things over time socio-economic

More information

Compiler Construction D7011E

Compiler Construction D7011E Compiler Construction D7011E Lecture 1: Introduction to compilers Viktor Leijon Slides largely by Johan Nordlander with material generously provided by Mark P. Jones. 1 Course Formalities 2 Teacher (me):

More information

Introduction to Functional Programming. Slides by Koen Claessen and Emil Axelsson

Introduction to Functional Programming. Slides by Koen Claessen and Emil Axelsson Introduction to Functional Programming Slides by Koen Claessen and Emil Axelsson Goal of the Course Start from the basics Learn to write small-to-medium sized programs in Haskell Introduce basic concepts

More information

CS/SE 153 Concepts of Compiler Design

CS/SE 153 Concepts of Compiler Design San José State University Department of Computer Science CS/SE 153 Concepts of Compiler Design Section 1 Fall 2018 Course and Contact Information Instructor: Ron Mak Office Location: ENG 250 Email: ron.mak@sjsu.edu

More information

Compiler Construction

Compiler Construction Compiler Construction Lecture 1: Introduction Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/ Summer

More information

Overview of the Class

Overview of the Class Overview of the Class Copyright 2015, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California (USC) have explicit permission to make copies

More information

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified

! Broaden your language horizons. ! Study how languages are implemented. ! Study how languages are described / specified Course Goal CMSC 330: Organization of Programming Languages Introduction Instructors: Mike Hicks, Chau-Wen Tseng TAs: Srividya Ramaswamy, Eylul Dogruel, Khoa Doan Learn how programming languages work!

More information

CS164: Midterm I. Fall 2003

CS164: Midterm I. Fall 2003 CS164: Midterm I Fall 2003 Please read all instructions (including these) carefully. Write your name, login, and circle the time of your section. Read each question carefully and think about what s being

More information

Compiler Construction

Compiler Construction Compiler Construction Introduction and overview Görel Hedin Reviderad 2013-01-22 2013 Compiler Construction 2013 F01-1 Agenda Course registration, structure, etc. Course overview Compiler Construction

More information

CISC 124: Introduction To Computing Science II

CISC 124: Introduction To Computing Science II CISC 124: Introduction To Computing Science II instructor: Margaret Lamb instructor's home page: www.cs.queensu.ca/home/malamb office: Goodwin 527 current office hours are always on my home page 1 Moodle

More information

Compilers and Code Optimization EDOARDO FUSELLA

Compilers and Code Optimization EDOARDO FUSELLA Compilers and Code Optimization EDOARDO FUSELLA The course covers Compiler architecture Pre-requisite Front-end Strong programming background in C, C++ Back-end LLVM Code optimization A case study: nu+

More information

Intermediate Representations

Intermediate Representations Most of the material in this lecture comes from Chapter 5 of EaC2 Intermediate Representations Note by Baris Aktemur: Our slides are adapted from Cooper and Torczon s slides that they prepared for COMP

More information

Compiler Design Spring 2018

Compiler Design Spring 2018 Compiler Design Spring 2018 Thomas R. Gross Computer Science Department ETH Zurich, Switzerland 1 Logistics Lecture Tuesdays: 10:15 11:55 Thursdays: 10:15 -- 11:55 In ETF E1 Recitation Announced later

More information

CS202 Compiler Construction. Christian Skalka. Course prerequisites. Solid programming skills a must.

CS202 Compiler Construction. Christian Skalka.  Course prerequisites. Solid programming skills a must. CS202 Compiler Construction Christian Skalka www.cs.uvm.edu/~skalka/202 CS 202-1 Introduction 1 Course prerequisites CS101 Must be able to read assembly CS103 Understand tree operations basic grammars

More information

What do Compilers Produce?

What do Compilers Produce? What do Compilers Produce? Pure Machine Code Compilers may generate code for a particular machine, not assuming any operating system or library routines. This is pure code because it includes nothing beyond

More information

CSC488S/CSC2107S - Compilers and Interpreters. CSC 488S/CSC 2107S Lecture Notes

CSC488S/CSC2107S - Compilers and Interpreters. CSC 488S/CSC 2107S Lecture Notes CSC 488S/CSC 2107S Lecture Notes These lecture notes are provided for the personal use of students taking CSC488H1S or CSC2107HS in the Winter 2013/2014 term at the University of Toronto Copying for purposes

More information

Overview of the Class

Overview of the Class Overview of the Class Copyright 2014, Pedro C. Diniz, all rights reserved. Students enrolled in the Compilers class at the University of Southern California (USC) have explicit permission to make copies

More information

15-411/ Compiler Design

15-411/ Compiler Design 15-411/15-611 Compiler Design Jan Hoffmann Fall 2016 http://www.cs.cmu.edu/~janh/courses/411/16 Teaching Staff Instructor: Jan Hoffmann Office hours: Tue 10:30am-noon Thu 1:00pm-2:30pm at GHC 9105 Teaching

More information

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS

HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS HOLY ANGEL UNIVERSITY COLLEGE OF INFORMATION AND COMMUNICATIONS TECHNOLOGY COMPILER THEORY COURSE SYLLABUS Code : 6COMTHEORY Prerequisite : 6AMATA Credit : 3 s (3 hours LEC) Year Level: 3 rd year Degree

More information

Compiler Design Overview. Compiler Design 1

Compiler Design Overview. Compiler Design 1 Compiler Design Overview Compiler Design 1 Preliminaries Required Basic knowledge of programming languages. Basic knowledge of FSA and CFG. Knowledge of a high programming language for the programming

More information

Why are there so many programming languages?

Why are there so many programming languages? Chapter 1 :: Introduction Programming Language Pragmatics, Fourth Edition Michael L. Scott Copyright 2016 Elsevier 1 Chapter01_ Introduction_4e - Tue November 21, 2017 Introduction Why are there so many

More information

Compiling Regular Expressions COMP360

Compiling Regular Expressions COMP360 Compiling Regular Expressions COMP360 Logic is the beginning of wisdom, not the end. Leonard Nimoy Compiler s Purpose The compiler converts the program source code into a form that can be executed by the

More information

CS 242. Fundamentals. Reading: See last slide

CS 242. Fundamentals. Reading: See last slide CS 242 Fundamentals Reading: See last slide Syntax and Semantics of Programs Syntax The symbols used to write a program Semantics The actions that occur when a program is executed Programming language

More information

Read & Download (PDF Kindle) Engineering A Compiler

Read & Download (PDF Kindle) Engineering A Compiler Read & Download (PDF Kindle) Engineering A Compiler The proliferation of processors, environments, and constraints on systems has cast compiler technology into a wider variety of settings, changing the

More information

CS 406/534 Compiler Construction Putting It All Together

CS 406/534 Compiler Construction Putting It All Together CS 406/534 Compiler Construction Putting It All Together Prof. Li Xu Dept. of Computer Science UMass Lowell Fall 2004 Part of the course lecture notes are based on Prof. Keith Cooper, Prof. Ken Kennedy

More information

CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation

CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation CS164: Programming Assignment 5 Decaf Semantic Analysis and Code Generation Assigned: Sunday, November 14, 2004 Due: Thursday, Dec 9, 2004, at 11:59pm No solution will be accepted after Sunday, Dec 12,

More information

A Brief Haskell and GHC Refresher

A Brief Haskell and GHC Refresher A Brief Haskell and GHC Refresher Henrik Nilsson and Neil Sculthorpe School of Computer Science University of Nottingham 24th September 2013 1 Introduction The purpose of this document is to give you quick

More information

Programming Languages 2nd edition Tucker and Noonan"

Programming Languages 2nd edition Tucker and Noonan Programming Languages 2nd edition Tucker and Noonan" " Chapter 1" Overview" " A good programming language is a conceptual universe for thinking about programming. " " " " " " " " " " " " "A. Perlis" "

More information

Part A: Course Outline

Part A: Course Outline University of Macau Faculty of Science and Technology Course Title: Department of Electrical and Computer Engineering Part A: Course Outline Communication System and Data Network Course Code: ELEC460 Year

More information

Compiler Construction Lecture 1: Introduction Winter Semester 2018/19 Thomas Noll Software Modeling and Verification Group RWTH Aachen University

Compiler Construction Lecture 1: Introduction Winter Semester 2018/19 Thomas Noll Software Modeling and Verification Group RWTH Aachen University Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ws-1819/cc/ Preliminaries Outline of Lecture 1 Preliminaries What

More information

Compiler Construction Lecture 1: Introduction Summer Semester 2017 Thomas Noll Software Modeling and Verification Group RWTH Aachen University

Compiler Construction Lecture 1: Introduction Summer Semester 2017 Thomas Noll Software Modeling and Verification Group RWTH Aachen University Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-17/cc/ Preliminaries People Lectures: Thomas Noll (noll@cs.rwth-aachen.de)

More information

COMPILER DESIGN LECTURE NOTES

COMPILER DESIGN LECTURE NOTES COMPILER DESIGN LECTURE NOTES UNIT -1 1.1 OVERVIEW OF LANGUAGE PROCESSING SYSTEM 1.2 Preprocessor A preprocessor produce input to compilers. They may perform the following functions. 1. Macro processing:

More information