CSCD 420 Dec 01 2026
Overview
Chris Cain reviews final-exam logistics and a Homework 6 grading correction, then teaches LL(1) parsing from FIRST and FOLLOW sets through parse-table construction, implementation, and a step-by-step parse. He shows how table collisions reveal the need for more lookahead, demonstrates an LL(2) grammar, and begins calculating the lookahead requirement for a larger grammar, leaving its S case and table size for the next class.
Key takeaways
- The final exam is scheduled for Wednesday, 10:30 a.m. to 12:30 p.m.; it is weighted like the other exams, designed for about one hour, and includes a conceptual cumulative section.
- For the reviewed grammar, FIRST(S) = {A, B, C}, FIRST(A) = {B, C}, FOLLOW(S) = {B, $}, and FOLLOW(A) = {A, B, $}.
- An LL(1) parse-table cell must contain at most one production; a collision means one symbol of lookahead cannot choose the rule unambiguously.
- The grammar S to ASB or AB is not LL(1), because both rules begin with A, but two-symbol lookahead distinguishes AA for ASB from AB for AB.
- An LL parser matches terminals directly against lookahead and expands non-terminals through table entries; it accepts only when both the stack and input are exhausted.
- In the larger grammar exercise, B requires one-symbol lookahead and C requires two; the exact requirement for S remains for the next class.
Chapters
- The final exam is Wednesday from 10:30 a.m. to 12:30 p.m. and covers Exam Four material.
- Chris Cain says the exam is designed for about one hour, has the same weight as the other exams, and includes a small conceptual cumulative section.
- The cumulative questions focus on how language classes and course concepts connect, not on repeating earlier problem-solving questions such as constructing a DFA.
- The grader will correct Homework 6 deductions for valid NPDA constructions that accept after emptying the stack, with changes expected by the end of the weekend.
- Cain explains that accepting through an empty stack and then reaching a final state is logically equivalent to the alternate construction taught in class.
- Course evaluations are open, and Cain asks students to provide candid feedback because the response rate and comments matter during his promotion and tenure review year.
- The remaining course plan is to finish LL parsing and LR parsing, then pivot to final-exam review and questions about the LL parse project due the following week.
- LR parsing will not be on the final and has no assigned work, but Cain says it helps connect the course topics.
- For the reviewed grammar, FIRST(S) is {A, B, C}, FIRST(A) is {B, C}, FOLLOW(S) is {B, $}, and FOLLOW(A) is {A, B, $}.
- The LL(1) table uses non-terminals as rows and terminals, including the end marker $, as columns.
- Each populated cell identifies the production to apply for the stack's top non-terminal and the current lookahead symbol.
- A blank cell means no production can handle that combination, so the parse fails; a table with at most one production per cell is LL(1).
- The parser uses push, top, pop, and get operations; push places a production's right-hand side on the stack from right to left.
- For a terminal on top of the stack, the parser matches it against lookahead, pops it, and advances the input; a mismatch rejects the string.
- For a non-terminal, the parser consults the LL table and pushes the selected production, rejecting if the cell is empty.
- Acceptance requires both an empty stack and the input position at the end-of-string marker.
- Cain traces a sample string by recording the stack and lookahead, applying productions such as S to ASB and A to BAA or C.
- The parse accepts when the stack is empty and the lookahead is $, showing how table choices guide each production and terminal match.
- Cain describes the parser's overall work as amortized linear in the input length, despite individual production expansions adding multiple stack symbols.
- A grammar is not LL(1) if any parse-table cell contains multiple productions, because one lookahead symbol cannot select a unique rule.
- In the example S to ASB or AB, both productions begin with A, so the LL(1) table collides at row S, column A.
- Two characters resolve the choice: AA indicates ASB, while AB indicates AB.
- An LL(2) table has columns for possible two-symbol lookahead sequences, including AA, AB, BA, BB, and sequences ending in $.
- The example assigns AA to production ASB and AB to production AB, leaving the other relevant columns blank.
- Because no cell has multiple entries after adding the second lookahead symbol, the example grammar is LL(2).
- Cain asks students to determine the maximum lookahead needed to distinguish each non-terminal's alternative productions, then take the maximum across the grammar.
- For non-terminal B, the alternatives AB and BC can be distinguished with one symbol: lookahead A selects AB, while B selects BC.
- For non-terminal C, the alternatives share an initial A, but two-symbol lookahead distinguishes AB from A followed by the end marker, so C requires LL(2).
- Cain identifies S as the remaining difficult non-terminal after establishing that B is LL(1) and C is LL(2).
- The exact lookahead requirement for S is left unresolved at the end of class.
- Cain closes by previewing a follow-up question: how large the LL parse table would become for the grammar.
Transcript excerpt
0:23 The first one is up on the board. This one's the most straightforward. Our finals period is 10:30 to 12:30 on Wednesday of next week. That will just be exam four. I'll give that study guide to you by the end of today. And that way, if I forget, someone send me an angry email as always. But it is on my short-term to-do list. It should not take you the full two hours. It's designed as a one-hour exam just like the others. It's weighted exactly the same as any of the other exams. So it's not it's not worth more. It's not going to be significantly longer. There is one small cumulative section on the study guide.
1:09 And the kinds of questions that I would ask with regards to it are more of a how the class and concepts throughout the class tie together and not questions that shouldn't have been on another exam. So you will not need to study all of the study guides for all of the exams. I'm not going to ask you to construct a DFA or some kind of problem-solving question from another exam, just how do how do these ideas of different language classes come together in terms of the finals, in terms of the theory of computer science. >> Is that the question? >> It's kind of a it's the overarching theme of the the questions and topics that are in the cumulative section of the study guide. So if you're starting
1:55 to think about that early, it's not it's not worse than any other exam and historically this has been the easiest of the four exams as I have as I've written them. So I kind of I want to build in a bit of an exam related curve
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, Chris Cain.