Syntax analysis: top-down and bottom-up parsing
Compiler Design · Engineering
Study notes
Parse 'a+b*c' with grammar E->E+T|T, T->T*F|F: bottom-up shifts a, reduces to F to T to E; shifts +, shifts b, reduces to T; shifts *, shifts c, reduces to F; reduces T*F to T, then E+T to E. The parse tree respects precedence: b*c groups first. Recursive descent would need the grammar rewritten without left recursion.