COMPSCI 3TB3 / SFWRENG 4TB3 Syntax-Based Tools and Compilers

Emil Sekerinski, Winter Term 2024/25

Instructor

  • Emil Sekerinski
  • Office hours: Thursdays 2:30 - 3:20 and by appointment, ITB 215

Prerequisites

For COMPSCI 3TB3: COMPSCI 2C03, COMPSCI 2GA3, COMPSCI 2AC3 or 2FA3, and COMPSCI 3MI3
For SFWRENG 4TB3: SFWRENG 2C03, SFWRENG 2FA3, SFWRENG 2GA3, and registration in Level IV or above of a Software Engineering

Calendar Description

Lexical analysis, syntax analysis, type checking; syntax-directed translation, attribute grammars; compiler structure; implications of computer architecture; mapping of programming language concepts; code generation and optimization.

Midterm and Exam Dates

  • Midterm Test: Wednesday, February 26, 1:30 - 2:20 (class time), T13 123 and T13 101; details will be announced on Avenue
  • Final Exam: as announced on Mosaic

Format and Attendance

  • The lectures and the tutorial introduce the course material through the course notes. Further study of the course notes is required, but reading in advance is not. Lectures and tutorials will have similar form.
  • The labs present ungraded lab questions, discuss their solution, introduce the graded assignment questions, and present the solutions to the assignment questions of the previous week. The solutions to lab questions and assignments are only presented in the lab sessions; they are not posted.
  • Attendance at the labs is required but not checked. Regular attendance to the lectures and labs is essential for the successful completion of the assignments, the midterm tests, and the final exam.

Material and Fees

  • The course notes are freely available on the JupyterHub server; see Avenue for access. They can either be used remotely or can be downloaded. While you only need a web browser to access the course notes, is recommended that you install Jupyter and extensions on your computer for offline reading of the course notes. All software used in this course is freely available.
  • You are asked to bring your laptop computer to the labs, midterm test, and final exam. Since the course notes are electronic and interactive, you can use your computer in the lectures and labs, but for the purpose of this course only. You must use your computer such that it is not distractive to those around you.

Learning Objectives

  • Compilers convert programs in "high-level" languages to executable code. This course introduces the concepts of compilation and illustrates those by a compiler for a small Pascal-like language for a RISC processor. However, this course is not just about writing compilers!
  • Students will learn to use parsing, analysis, and generation techniques for compilation and other syntax-directed processing (e.g. for query languages, mark-up languages, and protocols).
  • Students will see the topics of other courses connected, in particular, architecture, programming languages, formal languages, and operating systems.
  • Students will understand why programming languages are defined in the ways they are and be better prepared for new languages.
  • Students will appreciate efficiency issues in programming languages by understanding the memory layout of data types (e.g. arrays, objects) and compilation of control structures (e.g. short circuit evaluation, recursion), which leads to a better programming style.
  • Students will learn how compilation techniques (e.g. byte code, just-in-time, garbage collection) affect the suitability of programming languages for specific applications.
  • Students will learn about optimization techniques and the impact of processor architectures, which how helps in using compilers more effectively.
  • Students will be made aware of compiler construction tools (e.g. scanner and parser generators) and will be able to judge if and when to use them.

Topics

  1. Language and Syntax
  2. Regular Languages
  3. Analysis of Context-free Languages
  4. Syntax-Directed Translation
  5. The Construction of a Parser
  6. A Stack Architecture as Target
  7. A RISC Architecture as Target
  8. Further Data Types
  9. Concurrency and Parallelism
  10. Garbage Collection
  11. Generalized Parsing

Assessment

  • Midterm Test and Final Exam are worth 70%: if the grade of the midterm test is higher than that of the final exam, the midterm test is worth 22% and the final exam is worth 48%. If the grade of the midterm test is lower than that of the final exam, the final exam is worth 70%. That is, taking the midterm test can only improve your final grade, not lower it.
  • Assignments are worth 30%: there are 12 weekly assignments; each is introduced in the lab session for which you are registered. Each assignment is worth 3%; the marks are summed up and capped at 30%. That is, if you don't do perfectly on some assignments, you can stil get the full 30% of the assignments. If you MSAF an assignment, you get a 3-day extension. Collaboration on assignments is not allowed unless expliclity stated. Late submissions are not accepted.
  • Tests: You must take the final exam. If you do not take the midterm test, the weight will be shifted to the final exam. The tests include programming questions with Jupyter. You need to bring a laptop computer that runs a web browser to the tests.
  • The assignments, the midterm test, and the final exam are to be submitted on the JupyterHub server.

Academic Integrity

You are expected to exhibit honesty and use ethical behaviour in all aspects of the learning process. Academic credentials you earn are rooted in principles of honesty and academic integrity. It is your responsibility to understand what constitutes academic dishonesty.

Academic dishonesty is to knowingly act or fail to act in a way that results or could result in unearned academic credit or advantage. This behaviour can result in serious consequences, e.g. the grade of zero on an assignment, loss of credit with a notation on the transcript (notation reads: “Grade of F assigned for academic dishonesty”), and/or suspension or expulsion from the university. For information on the various types of academic dishonesty please refer to the Academic Integrity Policy

The following illustrates only three forms of academic dishonesty:

  1. Plagiarism, e.g. the submission of work that is not one’s own or for which other credit has been obtained.
  2. Improper collaboration in group work.
  3. Copying or using unauthorized aids in tests and examinations.

Authenticity / Plagiarism Detection

All submitted work is subject to normal verification that standards of academic integrity have been upheld. This course may also uses an automated plagiarism detector to reveal authenticity and ownership of code and prose submitted on JupyterHub.

Online Elements

This course is using Avenue, Teams, and JupyterHub. Students should be aware that, when they access the electronic components of this course, private information such as first and last names, user names for the McMaster e-mail accounts, and program affiliation may become apparent to all other students in the same course. The available information is dependent on the technology used. Continuation in this course will be deemed consent to this disclosure. If you have any questions or concerns about such disclosure please discuss this with the course instructor.

Conduct Expectations

As a McMaster student, you have the right to experience, and the responsibility to demonstrate, respectful and dignified interactions within all of our living, learning and working communities. These expectations are described in the Code of Student Rights & Responsibilities (the “Code”). All students share the responsibility of maintaining a positive environment for the academic and personal growth of all McMaster community members, whether in person or online. It is essential that students be mindful of their interactions online, as the Code remains in effect in virtual learning environments. The Code applies to any interactions that adversely affect, disrupt, or interfere with reasonable participation in University activities. Student disruptions or behaviours that interfere with university functions on online platforms (e.g. use of Avenue 2 Learn, Teams, or Zoom for delivery), will be taken very seriously and will be investigated. Outcomes may include restriction or removal of the involved students’ access to these platforms.

Academic Accommodation of Students with Disabilities

Students with disabilities who require academic accommodation must contact Student Accessibility Services (SAS) at 905-525-9140 ext. 28652 or sas@mcmaster.ca to make arrangements with a Program Coordinator. For further information, consult McMaster University’s Academic Accommodation of Students with Disabilities policy.

Request for Relief for Missed Academic Term Work

In the event of an absence for medical or other reasons, students should review and follow the Policy on Requests for Relief for Missed Academic Term Work.

Academic Accommodation Religious, Indigenous, or Spiritual Observances (RISO)

Students requiring academic accommodation based on religious, indigenous or spiritual observances should follow the procedures set out in the RISO policy. Students should submit their request to their Faculty Office normally within 10 working days of the beginning of term in which they anticipate a need for accommodation or to the Registrar's Office prior to their examinations. Students should also contact their instructors as soon as possible to make alternative arrangements for classes, assignments, and tests.

Copyright and Recording

Students are advised that lectures, demonstrations, performances, and any other course material provided by an instructor include copyright protected works. The Copyright Act and copyright law protect every original literary, dramatic, musical and artistic work, including lectures by University instructors. The recording of lectures, tutorials, or other methods of instruction may occur during a course. Recording may be done by either the instructor for the purpose of authorized distribution, or by a student for the purpose of personal study. Students should be aware that their voice and/or image may be recorded by others during the class. Please speak with the instructor if this is a concern for you.

Extreme Circumstances

The University reserves the right to change the dates and deadlines for any or all courses in extreme circumstances (e.g., severe weather, labour disruptions, etc.). Changes will be communicated through regular McMaster communication channels, such as McMaster Daily News, Avenue to Learn and/or McMaster email.