انت هنا الان : شبكة جامعة بابل > موقع الكلية > نظام التعليم الالكتروني > مشاهدة المحاضرة
الكلية كلية تكنولوجيا المعلومات
القسم قسم البرامجيات
المرحلة 3
أستاذ المادة حوراء شريف حمزة حسين
11/03/2015 06:10:00
Constructing a Parse Tree It is often useful to construct a parse tree explicitly. This can be done quite simply as we perform shift reduce parsing. The strategy is to maintain a forest of partially-completed derivation trees as we parse bottom-up. With each symbol on the stack we associate a pointer to a tree whose root is that symbol and whose yield is the string of terminal, which have been reduced to that symbol, perhaps by a long serious of reductions. At the end of the shift-reduce parsing, the start symbol remaining on the stack will have the entire parse tree associated with it. The bottom-up tree construction process has two aspects. 1- When we shift an input symbol a onto the stack we create a one-node tree labelled a. Both the root and the yield of this tree are at, and the yield truly represents the string of the terminals "reduced" (by zero reduction) to symbol a. 2- When we reduce X1, X2, … Xn to A, we create a new node labelled A. It s children, from the left to right, are the roots of the treeConstructing a Parse Tree It is often useful to construct a parse tree explicitly. This can be done quite simply as we perform shift reduce parsing. The strategy is to maintain a forest of partially-completed derivation trees as we parse bottom-up. With each symbol on the stack we associate a pointer to a tree whose root is that symbol and whose yield is the string of terminal, which have been reduced to that symbol, perhaps by a long serious of reductions. At the end of the shift-reduce parsing, the start symbol remaining on the stack will have the entire parse tree associated with it. The bottom-up tree construction process has two aspects. 1- When we shift an input symbol a onto the stack we create a one-node tree labelled a. Both the root and the yield of this tree are at, and the yield truly represents the string of the terminals "reduced" (by zero reduction) to symbol a. 2- When we reduce X1, X2, … Xn to A, we create a new node labelled A. It s children, from the left to right, are the roots of the trees for X1, X2, … Xn. If for all I the tree for Xi has yielded Xi, then the yield fos for X1, X2, … Xn. If for all I the tree for Xi has yielded Xi, then the yield fo
المادة المعروضة اعلاه هي مدخل الى المحاضرة المرفوعة بواسطة استاذ(ة) المادة . وقد تبدو لك غير متكاملة . حيث يضع استاذ المادة في بعض الاحيان فقط الجزء الاول من المحاضرة من اجل الاطلاع على ما ستقوم بتحميله لاحقا . في نظام التعليم الالكتروني نوفر هذه الخدمة لكي نبقيك على اطلاع حول محتوى الملف الذي ستقوم بتحميله .
|