Save this video free

[HD] EECS4302 F26 - 2026-12-03 (Thursday) - Lecture 24

Jackie Wang · 1:54:11 · Watch on YouTube

Part of York University EECS3342/EECS4302. See all 38 lectures and search them

These notes were made with YouTube Collector. Paste any YouTube link and get the same: a summary, chapters and a searchable transcript.

Overview

Jackie Wang explains how to compute FIRST and FOLLOW sets for context-free grammars, then combines them into START sets for one-symbol lookahead parsing. The lecture applies fixed-point algorithms and nullable-symbol reasoning to an expression grammar, shows how overlapping START sets expose backtracking and how left factoring can fix a common-prefix conflict, and closes with LL(1) recursive-descent parsing.

Key takeaways

Chapters

0:00 FIRST Sets: Definition for Terminals and Variables
3:00 The getFirst Map and Its Base Cases
6:30 Fixed-Point Iteration and Nullable Production Components
13:00 Tracing FIRST for Factor in the Expression Grammar
20:00 Expression Prime and FIRST Propagation Through Nullable Symbols
24:40 Extending FIRST from Single Symbols to Production Sequences
30:10 Applying Extended FIRST to Term and Operator Sequences
38:00 Why FIRST Alone Cannot Always Avoid Backtracking
43:00 FOLLOW Set Definition and Required FIRST Information
49:00 Finding FOLLOW Occurrences on Production Right-Hand Sides
54:00 FOLLOW Examples for Expression Prime and Term
59:00 The getFollow Algorithm and Fixed-Point Termination
1:05:00 Reverse Scanning and the FOLLOW Trailer
1:11:00 FOLLOW Cases for Nullable and Nonnullable Suffixes
1:18:00 Starting FOLLOW Computation on the Expression Grammar
1:24:00 Propagating FOLLOW Through Expression and Term Productions
1:28:00 START Sets Combine FIRST and FOLLOW for Nullable Alternatives
1:33:00 Checking Backtrack Freedom with Pairwise START Sets
1:39:00 Left Factoring Removes a Shared Grammar Prefix
1:44:00 Top-Down Parsing: Left Recursion and Decidability
1:49:00 Recursive-Descent Parsing and the Meaning of LL(1)
1:52:00 ANTLR-Style LL(1) Branching on Expression-Prime Lookahead

Keep these chapters and the full searchable transcript in your own library.

Transcript excerpt

0:05 Let's focus on this one first. This is more like the abstract definition for the first set, okay? The alpha here, okay, let's take a look. Whenever you want to do a computation for the first, you can pass an alpha. Alpha can either be a terminal, like a symbol, or it could be a variable. There are two cases. In the case where the alpha is simply a terminal, what will be the first set for terminal? What do you see first in a terminal? Well, just the terminal itself. So that's why it's simply just alpha. That's very straightforward. You can think about that's the base case. What about the recursive case? If you actually got some variable over here,

0:53 basically what you need is to somehow go through some derivation step. Right? You can see that exactly over here. In order for me to figure out the first of certain variable, is going to be all the words. So you can think about the W here, all the terminals or the words. That's why you see W is simply sigma star, right? There's no variable here. For all such W, alpha is able to be derived into something starting with W. And the beta over here is something we don't care. Okay? You can think about W is the starting symbols. And such string can be derived from this

1:41 alpha, which we want to calculate its first set. Okay? That's the definition. And uh yep, that's the abstract definition. That's something you can maybe spend a little bit more time looking into once we have gone through the algorithm. Any part of the definition you are not so sure about, you want me to go over, but I think that's pretty much it. Okay? Just remember the W over here should be all terminals.

This is the start of the transcript. Save this video free for the whole transcript, searchable and time-coded.

In this course

Related notes

Summary, takeaways, and chapters were generated by AI from the video's transcript and may contain errors. The video belongs to its creator, Jackie Wang.

Want the full transcript?

Save this video in YouTube Collector to get its complete searchable transcript, your own AI summaries, and a library that keeps every video you collect in one place.