Revised April 28, 2010

CS 241: Foundations of Sequential Programs


General Description

CS 241 covers the relationship between high-level programming languages and the computer architecture that underlies their implementation. Students will learn the fundamentals of the compilation of computer programs to machine-executable code. They will learn how to implement simple versions of the relevant algorithms. Particular topics include the following.

Logistics

Intended for 2B students in Computer Science; optional for Computational Mathematics. Normally available Fall, Winter and Spring.

Related courses (see calendar for official details)

Predecessor: CS 246 or (CS 138 and enrolled in software engineering).
Successors: Most third-year CS major courses.
Friends: Taking CS 241 together with CS 251 works well.
Conflicts: Other courses that focus on the process of turning programs into executable code.
Software used: UNIX/Linux, C++, optionally Scheme.

Typical Reference(s)

D. Patterson, J. Hennessy, Computer Organization and Design, 4th ed., Morgan Kaufmann.
A. Robbins, Unix in a Nutshell, 4th ed., O'Reilly, 1999.

Required preparation

At the start of the course, students should have the ability to At their discretion, individual instructors may choose to use Scheme in addition to C/C++. Assignments written in Scheme, if any, may be at the level indicated above for C/C++ (mutatis mutandis). Prior facility with Scheme is never required, however.

Learning objectives

At the end of the course, students should have the following abilities. In these, to "write" a program includes good performance in all aspects—design, coding, debugging, and testing—and presumes that the final code actually works.

Typical syllabus

Machine architecture and assembly language (6 hours)

Functional components of a computer: memory, control unit, arithmetic/logic unit, input/output devices. Data representation. Machine language: operation codes, addressing modes, indexing, base registers, register designation.

Assemblers, linkers, and loaders (6 hours)

Mnemonic op-codes, pseudo-ops, symbolic constants and addresses, literals. Assembler algorithm, linker and loader algorithms.

Regular languages and scanning (5 hours)

Architecture of a compiler. Syntax vs. semantics. Introduction to formal languages. Regular languages, regular expressions and finite state machines.

Context-free languages and parsing (8 hours)

Context-free grammars, derivations, derivation trees, ambiguous grammars. Introduction to top-down and bottom-up parsing, LL(1) and LR(1) grammars. Tool-based parser generation

Semantic Analysis and Code generation (6 hours)

Constructing parse trees. Code generation.

Runtime organization and data layout (5 hours)

Machine-level implementation of procedure invocation and the runtime stack. Implications of stack versus heap allocation. Main-storage layout for structures, vectors, and arrays.


Campaign Waterloo

David R. Cheriton School of Computer Science
University of Waterloo
Waterloo, Ontario, Canada N2L 3G1

Tel: 519-888-4567 x33293
Fax: 519-885-1208

Contact | Feedback: cs-uops@cs.uwaterloo.ca | David R. Cheriton School of Computer Science | Faculty of Mathematics


Valid HTML 4.01!Valid CSS! Last modified: Wednesday, 15-Feb-2012 10:30:40 EST


Menu:ShowHide