Search CTRL + K

Top-Down Parsing

自顶向下分析(top-down parsing) 就是从起始符号 S 开始不断挑选出合适的生产式,将右手端的非终结符展开,直到得到给定的句子或者返回无法得到。

由于展开有多重可能性,所以只有推导出所有的句子 L(G) 都不等于给定的句子,才能说无法展开。

主要实现:


Wikipedia

Top-down parsing in computer science is a parsing strategy where one first looks at the highest level of the parse tree and works down the parse tree by using the rewriting rules of a formal grammar. LL parsers are a type of parser that uses a top-down parsing strategy.[1]


  1. https://en.wikipedia.org/wiki/Top-down_parsing ↩︎