Ambiguity in CFGs - Solved Problems (Set 1)
ฝัง
- เผยแพร่เมื่อ 3 ต.ค. 2024
- Compiler Design: Ambiguity in CFGs - Solved Problems (Set 1)
Topics discussed:
1. UGC-NET December 2018 solved PYQ of Ambiguity in Context Free Grammars.
2. UGC-NET June 2018 solved PYQ of Ambiguity in Context Free Grammars.
Follow Neso Academy on Instagram: @nesoacademy (bit.ly/2XP63OE)
Contribute: www.nesoacadem...
Memberships: bit.ly/2U7YSPI
Books: www.nesoacadem...
Website ► www.nesoacadem...
Forum ► forum.nesoacad...
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#CompilerDesignByNeso #CompilerDesign #AmbiguityInCFGs
Hi I'd like to point out that for a grammar to be classified as ambiguous using a parse tree derivation, the grammar has to have either two or more left most parse tree derivation or two or more right most parse derivation for the same input string.
Please don't leave this out. Specify if your parse true will only do leftmost derivation or rightmost derivation.
How did you know what to derive??
Just generate any input from the grammar and test it
@@854Rri but what if the input that i generate doesnt necessarily have another way to derive it?
@upadhyay4677 I don't know if I understand it right, but you have to test another input then. Till you are sure (or can prove) that it is ambiguous or not
You would have to generate it using the set of terminals given
Hello, I just don't understand a thing: you said that to determine if a grammar is unambiguous or not is an undecidable problem, so there's no concrete approach/algorithm to do that but then you proceeded to prove that that grammar is ambiguous, using the ()()() string, how did you come up with that? I mean, how should I know what string to use in order to make it work?
By practicing, just like we do in Trigonometry.
Thanks for this extremely well-made content, you are a lifesaver! Quick question: how did you decide what strings to test with?
You used ababa, and then ab. Just wondering if those were given with the question or if you chose them somehow. Thanks again!
You just start with something and in the process of generation you will get some strings. Take them and try to make two parse trees. I solved like this both questions on my own. Thanks to him. It is not necessary to have strings in the beginning.
Sir your lectures are awesome and with easy explanation sir can you uplode more lectures plzzz
at 3:33, how is it ambigous when both trees are the same and have the same result?
How both trees are same ? they are different for the same expression. See his lectures carefully, he has already explained your answer in previous videos.
Thank you so much for uploading this video sir 😊🙏🙏🙏.
4:46 if not given how would you come up with 'ababa' ?
same )) how you know ababa ? and where is that ?. How about I come with "a". S -> a (only 1 tree, then it is not ambigous?). Other hand, If the grammar too complex or like 1000 rules. How we know the string like "ababa" ?
1:55 ahh yes SS :) iykuk
At 5:57 you have made 2 parse tree one is left most and another is right most, so how can it be Ambiguous Grammar
A Context Free Grammar is ambiguous, when to every word only one derivation tree exists. The derivation trees of left most and right most are different, so it is ambiguous. It also follows that either left most or right most derivation has ambiguous trees. This is also noticeable in the trees shown, because both trees could be derived from a left most derivation.
yeah hes wrong
To take your payment course , it's asking GST.
What we have to enter?
Please reply sir 😊
Hello, you can leave this field empty. It is for the people/company having a GST Number.
@@nesoacademy what is GST number?
@@monicabattacharya6416 GSTIN, short for Goods and Services Tax Identification Number, is a unique 15 digit identification number assigned to every taxpayer (primarily dealer or supplier or any business entity) registered under the GST regime.
what is string for Q1 ?
3 parenthesis or anything else ?????
3 pairs of parentheses
Can u share the link of queue in data structure
www.nesoacademy.org/cs/01-data-structures/07-queues/01-basics-of-queues
Thank you
We should pay for that?
@@harshithashetty233 yes ! Subscription