University of Waterloo

Term and Year of Offering: Winter 2017

Course Number and Title: CS462, Formal Languages and Parsing

Instructor's Name Office Location Contact Office Hours
Jeffrey Shallit DC 3134 Tuesday 1-2 PM, or by appointment, or whenever my door is open.

TA's Name Office LocationContactOffice Hours
Taylor J. Smith DC 3117 Thursdays 2-3PM

Course Description:

Building on CS 360, this course discusses more advanced topics in formal languages and automata theory, with applications to compiler writing. In particular, several practical parsing methods are discussed.

Course Objectives:

To introduce advanced topics in formal languages and parsing techniques to students, and enhance students' understanding of formal languages, automata theory and complexity theory. To look at interesting and challenging problems.

Course Overview:

Properties of Strings (3 hours) Outline of formal language theory. Strings, machines, proofs by induction. Combinatorics on words. Thue's problem. Regular Sets (9 hours) Review. Closure of regular sets under quotient, substitution, and inverse homomorphism. Decision algorithms for regular sets. The Myhill-Nerode theorem. Minimization of finite automata. Finite-state transducers. Context-free Languages (6 hours) Review. Coping with ambiguity. Inherently ambiguous CFL's. Closure of context-free languages under substitution, inverse homomorphism, and intersection with regular sets. Decision algorithms for context-free languages. Parsing arbitrary context-free grammars. Decidability results for CFG's. Parsing (9 hours) Phases of compilation. Top-down parsing. LL(1) grammars. Bottom-up parsing. LR(0) grammars. LR(k) grammars. The Chomsky Hierarchy (3 hours) Left- and right-regular grammars. Unrestricted (Type 0) grammars. Equivalence of Type 0 grammars and Turing machines. Context-sensitive languages. Linear bounded automata. Deterministic Context-free Languages (3 hours) Normal forms. Closure under complementation. Relationship to LR(0) grammars. Other Language Classes (3 hours) L-systems. Applications to computer graphics. Rational series.

Required text:

Jeffrey Shallit, A Second Course in Formal Languages and Automata Theory, Cambridge University Press, 2009.


CS462: 11 written assignments (50%); a take-home final exam (40%); in-class problem-solving sessions (10%).

Late policy:

Each assignment is due in class on Mondays. No late assignments will be accepted, and no assignments that are handed in after the solutions are given out will be accepted. If there are any valid reasons such as serious illness, please see the instructor. The lowest mark of the 11 assignments will be discarded.

Rules for Group Work:

Discussions on general aspects of the assignments are allowed, but each student should hand in his/her own solutions. ANY USE OF OUTSIDE SOURCES must be documented. Discussions during the take-home final period, other than asking the instructor or TA for clarifications on the take-home final, are strictly forbidden.

Indication of how late submission of assignments and missed assignments will be treated

Each assignment is due in class on Mondays. No late assignments will be accepted, and no assignments that are handed in after the solutions are given out will be accepted. If there are any valid reasons such as serious illness, please see the instructor. The lowest mark of the 11 assignments will be discarded.

Indication of where students are to submit assignments and pick up marked assignments

Each of the 11 assignments will be due on Mondays in class. The solutions will be available on the course web page. Marked assignments will be handed back in class, and students can also pick up see the instructor to pick up marked assignments.

Academic Integrity: In order to maintain a culture of academic integrity, members of the University of Waterloo community are expected to promote honesty, trust, fairness, respect and responsibility. [Check for more information.]

Grievance: A student who believes that a decision affecting some aspect of his/her university life has been unfair or unreasonable may have grounds for initiating a grievance. Read Policy 70, Student Petitions and Grievances, Section 4. When in doubt please be certain to contact the department's administrative assistant who will provide further assistance.

Discipline: A student is expected to know what constitutes academic integrity [check] to avoid committing an academic offence, and to take responsibility for his/her actions. A student who is unsure whether an action constitutes an offence, or who needs help in learning how to avoid offences (e.g., plagiarism, cheating) or about 'rules' for group work/collaboration should seek guidance from the course instructor, academic advisor, or the undergraduate Associate Dean. For information on categories of offences and types of penalties, students should refer to Policy 71, Student Discipline. For typical penalties check Guidelines for the Assessment of Penalties.

Appeals: A decision made or penalty imposed under Policy 70 (Student Petitions and Grievances) (other than a petition) or Policy 71 (Student Discipline) may be appealed if there is a ground. A student who believes he/she has a ground for an appeal should refer to Policy 72, Student Appeals.

Note for Students with Disabilities: The Office for persons with Disabilities (OPD), located in Needles Hall, Room 1132, collaborates with all academic departments to arrange appropriate accommodations for students with disabilities without compromising the academic integrity of the curriculum. If you require academic accommodations to lessen the impact of your disability, please register with the OPD at the beginning of each academic term.

Intellectual Property: Students should be aware that this course contains the intellectual property of their instructor, TA, and/or the University of Waterloo. Intellectual property includes items such as:

Course materials and the intellectual property contained therein, are used to enhance a student's educational experience. However, sharing this intellectual property without the intellectual property owner's permission is a violation of intellectual property rights. For this reason, it is necessary to ask the instructor, TA and/or the University of Waterloo for permission before uploading and sharing the intellectual property of others online (e.g., to an online repository).

Permission from an instructor, TA or the University is also necessary before sharing the intellectual property of others from completed courses with students taking the same/similar courses in subsequent terms/years. In many cases, instructors might be happy to allow distribution of certain materials. However, doing so without expressed permission is considered a violation of intellectual property rights.

Please alert the instructor if you become aware of intellectual property belonging to others (past or present) circulating, either through the student body or online. The intellectual property rights owner deserves to know (and may have already given their consent).