I've been trying to find the "first set" of this context-free grammar. I've come up with 2 answers but I'm unsure if they're correct. I would be grateful if someone could explain how to generate the first set of this grammar.
Both answers are written in different ways because the sources I've read have explained it with different syntax.
The grammar in question:
E1 -> E2+E1|E2
E2 -> num*E2|num
My first answer:
| A -> α | FIRST(α) |
|:----------- |------------:|
| E1 -> E2+E1 | {num, num} |
| E1 -> E2 | {num, num} |
| E2 -> num*E2 | {num} |
| E2 -> num | {num} |
My second answer:
FIRST(E1) = {num}
FIRST(E2) = {num}