University of Waterloo

Term and Year of Offering: Winter 2020

Course Number and Title: CS462, Formal Languages and Parsing

Section Lecture Time Room Instructor
1 10:00 AM - 11:20 AM MW DWE 1502 Jeffrey Shallit

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

TA's Name Office Location Contact Office Hours
Daniel Gabric DC 2136B Thursdays 11:30 AM - 12:30 PM

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 and Missed Assignments Policy:

Each assignment is due (on LEARN) on Fridays at 5 PM. 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.

Assignment Submission and Pickup:

Each of the 11 assignments will be due Fridays at 5 PM on LEARN in a LEARN dropbox. The solutions will be available on LEARN.

Mental Health Resources

Mental Health: If you or anyone you know experiences any academic stress, difficult life events, or feelings like anxiety or depression, we strongly encourage you to seek support.

On-campus Resources

Off-campus Resources

Diversity: It is our intent that students from all diverse backgrounds and perspectives be well served by this course, and that students' learning needs be addressed both in and out of class. We recognize the immense value of the diversity in identities, perspectives, and contributions that students bring, and the benefit it has on our educational environment. Your suggestions are encouraged and appreciated. Please let us know ways to improve the effectiveness of the course for you personally or for other students or student groups. In particular:

Academic Integrity

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.

MOSS (Measure of Software Similarities) is used in this course as a means of comparing students' assignments to ensure academic integrity. We will report suspicious activity, and penalties for plagiarism/cheating are severe. Please read the available information about academic integrity very carefully.

Discipline cases involving any automated marking system such as Marmoset or MarkUs include, but are not limited to, printing or returning values in order to match expected test results rather than making an actual reasonable attempt to solve the problem as required in the assignment question specification.

Note for Students with Disabilities: AccessAbility Services, located in Needles Hall, Room 1401, 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 AccessAbility Services 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).