TODO
I need to recorganize this entire note when I study for midterms
Here I call a βuβ non-terminal and something like A, a terminal
- Convert grammar from EBNF to BNF
- Determine nullable non-terminals (EPS)
- Which terminals go to ? (evaluates to 0 | 1)
- Determine First sets
- What is the first terminals we see for each non-terminal for our grammar?
- What does each sub-inout evaluate to (βuβ, βwβ, etc)
- Determine Follow sets
- What follows each non-terminal?
- Where is a symbol used? The follow of a symbol is the follow of the LHS that uses the symbol
- If a non-terminal follows the symbol use, then the follow is just that non-terminal
- Once we reach a non-terminal (end-case) back-propagate the result up to where we start
- Determine predict sets
- For a given predict set, we want to know what it will evaluate to, expressed in first and follow sets as well as terminals
- Predict sets are used when we
inspect, this tells us what production to use in our BNF - If a production can be empty you need to add the empty follow set to the predict set
If the predict sets are disjoint, write a recursive parser β LL(1) If the predict sets intersect, refactor the grammar to be LL(1) β Not LL(1)
Read for once in your life
Probably read the textbook since theoretically this is kind of abstract, in practice I should be able to just pick up the patterns.
EBNF to BNF
- Remove stars and bars (|) and add EOFs
- For an input string , we have one or many productions (on the left hand side we coupld have multiple terminals)
- Note to accommodate for (* / many), use recursion
- You use the predict set to decide which production to use based on the next token (inputs here)

We can turn this idea into codeβ¦
