This is a follow up question from Grammar: difference between a top down and bottom up?
I understand from that question that:
- the grammar itself isn't top-down or bottom-up, the parser is
- there are grammars that can be parsed by one but not the other
- (thanks Jerry Coffin
So for this grammar (all possible mathematical formulas):
E -> E T E
E -> (E)
E -> D
T -> + | - | * | /
D -> 0
D -> L G
G -> G G
G -> 0 | L
L -> 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9
Would this be readable by a top down and bottom up parser?
Could you say that this is a top down grammar or a bottom up grammar (or neither)?
I am asking because I have a homework question that asks:
"Write top-down and bottom-up grammars for the language consisting of all ..." (different question)
I am not sure if this can be correct since it appears that there is no such thing as a top-down and bottom-up grammar. Could anyone clarify?