③苇大 语店分教术小结 ◇自上而下分祈 ◇自下而上分析 ◇比 ◆二义性处理
语法分析技术小结 自上而下分析 自下而上分析 二义性处理 比较
③苇大 自上而下分析 ◇自上而下分祈一般过程 ◇LL(1)文法 ◇预测分析程序 递下障分析故术 表驱动分析技术
自上而下分析 自上而下分析一般过程 LL(1)文法 预测分析程序 − 递归下降分析技术 − 表驱动分析技术
③苇大 自上而下分析一般过程 In the top-down parsing, we begin with the start symbol and at each step, expand one of the remaining nonterminals by replacing it with the right side of one its productions We repeat until only terminals remain. The top down parse prints a leftmost derivation of the sentence
自上而下分析一般过程 In the top-down parsing,we begin with the start symbol and at each step, expand one of the remaining nonterminals by replacing it with the right side of one its productions. We repeat until only terminals remain. The topdown parse prints a leftmost derivation of the sentence
③苇大 LL(1)文法 The first"L, means we scan the input from left to right; the second L means we create a leftmost derivation and the 1 means one input symbol of lookahead A grammar G is ll(1) iff whenever A->u v are two distinct productions of G, the following conditions hold for no terminal a do both u and v derive strings beginning with a (i. e. first sets are disjoint) at most one of u and v can derive the empty string if v=>*8 then u does not derive any string beginning with a terminal in Follow (A)
LL(1)文法 The first “L” means we scan the input from left to right; the second “L” means we create a leftmost derivation; and the 1 means one input symbol of lookahead. A grammar G is LL(1) iff whenever A –> u | v are two distinct productions of G, the following conditions hold: - for no terminal a do both u and v derive strings beginning with a (i.e. first sets are disjoint) - at most one of u and v can derive the empty string - if v =>* then u does not derive any string beginning with a terminal in Follow(A)
③苇大 First集 The first set of a sequence of symbols u, written as First(u) is the set of terminals which start all the sequences of symbols derivable from u. a bit more formally, consider all strings derivable from u by a leftmost derivation If u=*v, where v begins with some terminal, that terminal is in First(u). Ifu=>*8 then s is in First(u)
The first set of a sequence of symbols u, written as First(u ) is the set of terminals which start all the sequences of symbols derivable from u. A bit more formally, consider all strings derivable from u by a leftmost derivation. If u =>* v , where v begins with some terminal, that terminal is in First(u). If u =>* , then is in First(u ). First 集