Bottom-up Syntax Analysis
摘要
The MicroJava compiler described in this book uses recursive descent parsing, which is a top-down technique. However, parsing can also be done bottom-up, where the syntax tree is built from the bottom to the top. Bottom-up parsing is more powerful than top-down parsing, but also more complicated, and it is harder to integrate semantic processing. Therefore, its use is usually limited to languages that are more complex than MicroJava. This chapter describes bottom-up parsing using a table-driven approach. It explains how to create the parser tables, how to integrate semantic actions, and how to recover after syntax errors.