0 · The question
Walkthrough 3:55 · watch first
The whole lab in one video: picking a past question, the LEX token rules, the YACC grammar, trying inputs in the browser, and the final .l + .y files. The optional AI-tutor key has its own video under AI tutor.
1 · Tokens: what LEX reads and what it passes on
One row per kind of lexeme, in order: on a tie LEX picks the earlier row, otherwise the longest match wins.
In a LEX+YACC program each useful row ends with return NAME; — that NAME is the token YACC sees.