منتدى الملوك
اهلا وسهلا بك زائرنا الكريم
منتديات الملوك ترحب بك أجمل ترحيب
ونتمنى لك وقتاً سعيداً مليئاً بالحب كما يحبه الله ويرضاه
فأهلاً بك في هذا المنتدى المبارك إن شاء الله
ونرجوا أن تفيد وتستفيد منا
منتدى الملوك
مع تحيات " ادراة المنتدى
✯ ملكة منتدى الملوك✯
منتدى الملوك
اهلا وسهلا بك زائرنا الكريم
منتديات الملوك ترحب بك أجمل ترحيب
ونتمنى لك وقتاً سعيداً مليئاً بالحب كما يحبه الله ويرضاه
فأهلاً بك في هذا المنتدى المبارك إن شاء الله
ونرجوا أن تفيد وتستفيد منا
منتدى الملوك
مع تحيات " ادراة المنتدى
✯ ملكة منتدى الملوك✯
منتدى الملوك
هل تريد التفاعل مع هذه المساهمة؟ كل ما عليك هو إنشاء حساب جديد ببضع خطوات أو تسجيل الدخول للمتابعة.


ترفيهي اجتماعي تعليمي ابداع تالق تواصل تعارف - مع تحيات : طاقم الادارة : ♥нαɪвατ мαℓєĸ ♥+ ✯ ملكة منتدى الملوك✯ +! ! آلأميرة »°♡
 
الرئيسيةالبوابةأحدث الصورالتسجيلدخول
<الســلام عليكم ورحمة الله , عزيزي الزائر / عزيزتي الزائرة منتَدَاكمً مُنتَدَى الملوك يُرَحبُ بكـُمً .. إنً كنتَ تَرغَب في الإنضمَامً إلى أسًرَة المنتَدَى سَنتَشَرَفُ بتَسًجيلَكَ .. فَمرُحَبا بالزَائرينَ , وَ العَابرينَ , وَ الأصدقَاء , واَ لأعضَاءَ , بالطَيبينَ وَ الطَيبَات .. وَ بكًل مَن يَثًرَى , أوً تَثُرَى المًنتَدَى بالحِوَارً , وَ المُنَاقَشةَ , وَ المسَاهَمَاتً المُفيدَةَ .. فَلَيًسَ للبُخَلاَء بالمَعرفَة مَكَانُُ هُنَا ..سَاهمَ / سَاهٍمي بكَلمَة طَيبَة , أوً مَقَالً , أوً لَوًحَة , أوً قَصيدَة , أوً فِكرَة , أوً رَأي , أوً خْبرَة تَدفَعً حَيَاتُنَا للأمَامً ... تحيَآت إدَارَة منتَدَى الملوك ")
difference entre SLR(1) etLR(1) en compilation  - صفحة 2 N3u5p1

 

 difference entre SLR(1) etLR(1) en compilation

اذهب الى الأسفل 
+19
COCAINE
خربڜڜآﺂٺ ملہۧہٰگك'ۦ، 'ۦ،
ÐoØñ Bågìrã xy
<<آإنہٰسہٰآإن راقہٰي!
صرخة الياسمين
جوهرة الجود
مشاكسة بكيفي
شكسبيرة
yasman
انثى لايكررها القدر
آلَكوِنٌتُيّسًسًـــآ
نجمة سهيل
La Petite Princesse
رغد الصلاحي
ج~نـون ع~أشـقـة
✯ ملكة منتدى الملوك✯
ღ شهقـآتٌ سَرمَدِيـَّةْ ღ
♥нαɪвατ мαℓєĸ♥
كبرياء لا يتحطم
23 مشترك
انتقل الى الصفحة : الصفحة السابقة  1, 2, 3, 4  الصفحة التالية
كاتب الموضوعرسالة
كبرياء لا يتحطم
عضو مجتهد
عضو مجتهد
avatar


ٱلبّـلـدُ : الجزائر
ٱلجَــنٌسً : ذكر
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 111
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 21/12/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالإثنين ديسمبر 23, 2013 5:03 pm

تذكير بمساهمة فاتح الموضوع :

Both LR(0) and SLR(1) parsers are bottom-up, directional, predictive parsers. This means that

The parsers attempt to apply productions in reverse to reduce the input sentence back to the start symbol (bottom-up)
The parsers scan the input from left-to-right (directional)
The parsers attempt to predict what reductions to apply without necessarily seeing all of the input (predictive)

Both LR(0) and SLR(1) are shift/reduce parsers, meaning that they process the tokens of the input stream by placing them on a stack, and at each point either shifting a token by pushing it onto the stack or reducing some sequence of terminals and nonterminals atop the stack back to some nonterminal symbol. It can be shown that any grammar can be parsed bottom-up using a shift/reduce parser, but that parser might not be deterministic. That is, the parser may have to "guess" whether to apply a shift or reduction, and may end up having to backtrack to realize that it made the wrong choice. No matter how powerful a deterministic shift/reduce parser you construct, it will never be able to parse all grammars.

When a deterministic shift/reduce parser is used to parse a grammar that it cannot handle, it results in shift/reduce conflicts or reduce/reduce conflicts, where the parser may enter a state in which it cannot tell what action to take. In a shift/reduce conflict, it cannot tell whether it should add another symbol to the stack or perform some reduction on the top symbols of the stack. In a reduce/reduce conflict, the parser knows that it needs to replace the top symbols of the stack with some nonterminal, but it can't tell what reduction to use.

I apologize if this is a lengthy exposition, but we need this to be able to address the difference between LR(0) and SLR(1) parsing. An LR(0) parser is a shift/reduce parser that uses zero tokens of lookahead to determine what action to take (hence the 0). This means that in any configuration of the parser, the parser must have an unambiguous action to choose - either it shifts a specific symbol or applies a specific reduction. If there are ever two or more choices to make, the parser fails and we say that the grammar is not LR(0).

Recall that the two possible LR conflicts are shift/reduce and reduce/reduce. In both of these cases, there are at least two actions that the LR(0) automaton could be taking, and it can't tell which of them to use. Since at least one of the conflicting actions is a reduction, a reasonable line of attack would be to try to have the parser be more careful about when it performs a particular reduction. More specifically, let's suppose that the parser is allowed to look at the next token of input to determine whether it should shift or reduce. If we only allow the parser to reduce when it "makes sense" to do so (for some definition of "makes sense"), then we may be able to eliminate the conflict by having the automaton specifically choose to either shift or reduce in a particular step.

In SLR(1) ("Simplified LR(1)"), the parser is allowed to look at one token of lookahead when deciding whether it should shift or reduce. In particular, when the parser wants to try reducing something of the form A → w (for nonterminal A and string w), it looks at the next token of input. If that token could legally appear after the nonterminal A in some derivation, the parser reduces. Otherwise, it does not. The intuition here is that in some cases it makes no sense to attempt a reduction, because given the tokens we've seen so far and the upcoming token, there is no possible way that the reduction could ever be correct.

The only difference between LR(0) and SLR(1) is this extra ability to help decide what action to take when there are conflicts. Because of this, any grammar that can be parsed by an LR(0) parser can be parsed by an SLR(1) parser. However, SLR(1) parsers can parse a larger number of grammars than LR(0).

In practice, though, SLR(1) is still a fairly weak parsing method. More commonly, you will see LALR(1) ("Lookahead LR(1)") parsers being used. They too work by trying to resolve conflicts in an LR(0) parser, but the rules they use for resolving conflicts are far more precise than those used in SLR(1), and consequently a much larger number of grammars are LALR(1) than are SLR(1). To be a bit more specific, SLR(1) parsers try to resolve conflicts by looking at the structure of the grammar to learn more information about when to shift and when to reduce. LALR(1) parsers look at both the grammar and the LR(0) parser to get even more specific information about when to shift and when to reduce. Because LALR(1) can look at the structure of the LR(0) parser, it can more precisely identify when certain conflicts are spurious. The Linux utilities yacc and bison, by default, produce LALR(1) parsers.

Historically, LALR(1) parsers were typically constructed through a different method that relied on the far more powerful LR(1) parser, so you will often see LALR(1) described that way. To understand this, we need to talk about LR(1) parsers. In an LR(0) parser, the parser works by keeping track of where it might be in the middle of a production. Once it has found that it's reached the end of a production, it knows to try to reduce. However, the parser might not be able to tell whether it's in at the end of one production and the middle of another, which leads to a shift/reduce conflict, or which of two different productions it has reached the end of (a reduce/reduce conflict). In LR(0), this immediately leads to a conflict and the parser fails. In SLR(1) or LALR(1), the parser then makes the decision to shift or reduce based on the next token of lookahead.

In an LR(1) parser, the parser keeps track of additional information as it operates. In addition to keeping track of what production the parser believes is being used, it keeps track of what possible tokens might appear after that production is completed. Because the parser keeps track of this information at each step, and not just when it needs to make the decision, the LR(1) parser is substantially more powerful and precise than any of the LR(0), SLR(1), or LALR(1) parsers we've talked about so far. LR(1) is an extremely powerful parsing technique, and it can be shown using some tricky math that any language that could be parsed deterministically by any shift/reduce parser has some grammar that could be parsed with an LR(1) automaton. (Note that this does not mean that all grammars that can be parsed deterministically are LR(1); this only says that a language that could be parsed deterministically has some LR(1) grammar). However, this power comes at a price, and a generated LR(1) parser may require so much information to operate that it can't possibly be used in practice. An LR(1) parser for a real programming language, for example, might require tens to hundreds of megabytes of additional information to operate correctly. For this reason, LR(1) isn't typically used in practice, and weaker parsers like LALR(1) or SLR(1) are used instead.

More recently, a new parsing algorithm called GLR(0) ("Generalized LR(0)") has gained popularity. Rather than trying to resolve the conflicts that appear in an LR(0) parser, the GLR(0) parser instead works by trying all possible options in parallel. Using some clever tricks, this can be made to run very efficiently for many grammars. Moreover, GLR(0) can parse any context-free grammar at all, even grammars that can't be parsed by an LR(k) parser for any k. Other parsers are capable of doing this as well (for example, the Earley parser or a CYK parser), though GLR(0) tends to be faster in practice.

If you're interested in learning more, over this summer I taught an introductory compilers course and spent just under two weeks talking about parsing techniques. If you'd like to get a more rigorous introduction to LR(0), SLR(1), and a host of other powerful parsing techniques, you might enjoy my lecture slides and homework assignments about parsing. All of the course materials are available
الرجوع الى أعلى الصفحة اذهب الى الأسفل

كاتب الموضوعرسالة
نجمة سهيل
عضو ملكي
عضو ملكي
نجمة سهيل


ٱلبّـلـدُ : عمان
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 2664
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 17/06/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالثلاثاء ديسمبر 24, 2013 4:56 pm

يعطيك العافيه
الرجوع الى أعلى الصفحة اذهب الى الأسفل
آلَكوِنٌتُيّسًسًـــآ
عضو ملكي
عضو ملكي
آلَكوِنٌتُيّسًسًـــآ


ٱلبّـلـدُ : الجزائر
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 25380
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 20/04/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالأربعاء ديسمبر 25, 2013 12:00 pm


الله يعطيك الف عافية

يسلمو
الرجوع الى أعلى الصفحة اذهب الى الأسفل
انثى لايكررها القدر
عضو ملكي
عضو ملكي
انثى لايكررها القدر


ٱلبّـلـدُ : الجزائر
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 29541
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 14/08/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالأربعاء ديسمبر 25, 2013 7:11 pm

يسلمو على النقل الحي والمعلومات المفيدة

سلمت يمينك
الرجوع الى أعلى الصفحة اذهب الى الأسفل
yasman
عضو مجتهد
عضو مجتهد
avatar


ٱلبّـلـدُ : المغرب
ٱلجَــنٌسً : ذكر
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 130
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 13/01/2014

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالثلاثاء يناير 14, 2014 6:31 am

تسسلم يمينك
على رووعه طرحك~
الله يعطيكي
الف عاآآآآآآفيه
الرجوع الى أعلى الصفحة اذهب الى الأسفل
شكسبيرة
عضو ملكي
عضو ملكي
شكسبيرة


ٱلبّـلـدُ : فلسطين
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 3637
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 04/06/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالإثنين يناير 20, 2014 2:58 pm

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Images?q=tbn:ANd9GcQteADAKc7OKURO1nCoYeuNRb9KyxDzpjiIh6qYWUXB9nmrQC9Clg
الرجوع الى أعلى الصفحة اذهب الى الأسفل
مشاكسة بكيفي
عضو ملكي
عضو ملكي
مشاكسة بكيفي


ٱلبّـلـدُ : فلسطين
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 8757
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 07/12/2013

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالأربعاء يناير 22, 2014 12:46 am

يعطيك العافية
الرجوع الى أعلى الصفحة اذهب الى الأسفل
جوهرة الجود
عضو نشيط
عضو نشيط
جوهرة الجود


ٱلبّـلـدُ : اليمن
ٱلجَــنٌسً : انثى
عـ,ـدد آلـمـسـ,ـآهـ,ـمــآت : 203
تـ,ـآريـخ آلـتـسـجـيـ,ـل : 25/01/2014

difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Empty
مُساهمةموضوع: رد: difference entre SLR(1) etLR(1) en compilation    difference entre SLR(1) etLR(1) en compilation  - صفحة 2 Emptyالأحد يناير 26, 2014 7:49 am

مشكوور
منتظرين جديدك
الرجوع الى أعلى الصفحة اذهب الى الأسفل
 
difference entre SLR(1) etLR(1) en compilation
الرجوع الى أعلى الصفحة 
صفحة 2 من اصل 4انتقل الى الصفحة : الصفحة السابقة  1, 2, 3, 4  الصفحة التالية
 مواضيع مماثلة
-
» Best Babies and Animals Compilation 2013 [HD]

صلاحيات هذا المنتدى:لاتستطيع الرد على المواضيع في هذا المنتدى
منتدى الملوك  :: اطوار النهائي للبكالوريا والدراسات الجامعية والابحاث والدروس الخصوصية :: الدراسات الجامعية والابحاث-
انتقل الى: