The descriptions are for modules currently being taught. They should be viewed as an example of the modules we provide. All modules are subject to change for later academic years.

Lexical & Syntax Analysis of Programming Languages (LSA) 2010/1

Workload - Private Study - Assessment - Description - Learning Outcomes - Content - Teaching Materials - Recommended Books

Module Code 0620354
Lecturers Matthew Naylor
Taken By CS 2, CS/Math 2, MMath 2, CS/Math 3, MMath 3, CSESE 2, MEng CSESE 2, CSSE 2, MEng CSSE 2, MEng CSAI 2
Number of Credits 10
Part B
Teaching Spr/8-10, Sum 3-6
Closed Assessment [100%] Summer Week 8, 1.50 hours

Module Prerequisites

Prerequisite knowledge

Students must have a prior knowledge of programming in C. CCC provides a suitable introduction, but cannot be made a compulsory pre-requisite. Students will be assumed to have a knowledge of formal languages and automata. For most students this will have been acquired in MCS but others (e.g. CS/Maths students) must ensure that they have this knowledge from somewhere else (e.g. first-year CS tutorials).

Prerequisite modules

Workload

  • Lectures: 14 x 1hr
  • Practicals: 4 x 2hrs
  • Private Study: 76.5hrs
  • Assessment: 1.5hrs

Private Study

In addition to reading, students will be expected to work on problem sheets and on practical work that is not possible to complete in the timetabled practical sessions.

Assessment

Closed Assessment

  • Summer Week 8, 1.50 hours

Assessed by a 90-minute closed examination (worth 50 marks): Answer 1 compulsory question plus 1 other from a choice of 2.

Formative Feedback

Students must complete a number of exercises. Students are encouraged to ask the lecturer and demonstrators for assitance and suggestions. Sample solutions are released week-by-week and general feedback is also posted on the module web page.

Description

The number of people who write compilers is small, so why is a module about compiler construction a compulsory part of a computer science course? One reason is that, though few graduates of the course will end up writing compilers, all will have to use them. Also many of the techniques used in compilers have application in other areas such as dialogue and human-computer interface design. This module will give a broad introduction to syntax-directed compilation of programming languages. The module does not cover code generation, which is covered in the third-year module, Code Generation and Optimisation (CGO).

Learning Outcomes

The aim of this module is to introduce the student to the theory and practice of programming language compilation. It works through the `front end' of compilation: lexical and syntax analysis. By the end of the module the student will be in a position to write a lexical scanner and a parser for a context-free language, including the use of compiler tools. The student will also have a solid understanding on the underlying theory of formal languages. Finally, the student should have a better appreciation of good programming practice in terms of program compilation.

Content

Lecture notes are arranged in chapters. A single chapter may span over several lectures. Chapters include:

1 Introduction
2 Abstract syntax
3 Lexical analysis
4 Flex, a lexical analyser generator
5 Grammars and Parse Trees
6 Top-down parsing
7 Bison, a parser generator
8 Bottom-up parsing
9 Parser combinators (if time permits)

Practical classes:

1 Lexical scanning
2 Flex
3 Recursive descent
4 Bison

Teaching Materials

Notes and exercise sheets will be provided. Information and feedback will be posted on the module web pages.

Recommended Books

Rating Author Title Publisher Year
**** Louden K.C. Compiler Construction Principles and Practice PWS 1997
** Kelley, A, Pohl, I A Book on C Addison Wesley 1998
* Parsons T.W. Introduction to Compiler Construction Computer Science Press 1992
++ Aho A.V. et al. Compilers: Principles, Techniques and Tools Addison Wesley 1986
+ Ben-Ari, M. Understanding Programming Languages Wiley 1995
+ Clements, A. The Principles of Computer Hardware OUP 2000
+ Elder J. Compiler Construction: A Recursive Descent Model Prentice Hall 1994
Back to top

Last updated: 1st June 2011