- 作者: 楊武
- 作者服務機構: 國立交通大學資訊科學系
- 中文摘要: 屬性文法是與前後文無關語言上之一種計算架構。針對屬性公式中的if敘述之非嚴格性,我們可以巧妙地安排計算屬性的順序,以避免計算無必要之屬性。雖然動態式屬性計算器可以達到類似的效果,但是動態式屬性計算器須針對個別的語法樹,計算其屬性之先後順序,並且須要將整棵語法樹儲存在記憶體內,因此動態式計算器比較缺乏效率。相對的,靜態式屬性計算器亦可以避免無需之計算,而無動態式計算器之缺點。我們提出一套方法,藉由仔細分析屬性之間的相依性,來安排計算屬性之順序,以避免無需之計算工作,這套方法可以用於靜態式屬性計算器。
- 英文摘要: Attribute grammars are a formalism for specifying computations on context-free languages. Dueto the nonstrictness of the if constructs in attribution equations, it is possible to avoid evaluating certainattribute instances in a syntax tree. A dynamic evaluator can easily avoid such useless computations witha demand-driven approach. However, dynamic evaluators are not efficient because they need to keepthe attribute dependence graph during evaluation, and they need to decide an evaluation order for eachsyntax tree. In contrast, a visit-oriented (static) evaluator can carefully re-arrange the evaluation orderand still avoid unnecessary computations. We propose such a technique in this paper.
- 中文關鍵字: --
- 英文關鍵字: --