That is purely a matter of looking at the grammar. Each parent and its children must match one of the rules for that nonterminal. And reading across the leaves of the tree from left to right, you must have the "sentence" that you're trying to parse. If both of those things are true, you have a correct parse tree.
Thank you for the super helpful content! I’m finding some difficulty on deciding how to correctly disambiguate and parse unary and binary operators, or infix and prefix/suffix Specifically the minus and negation operator (-) Do you have some insights or resources I can consult to better understand how to disambiguate them?
Telling unary minus from binary in an infix setting is usually straightforward, because it's a matter of whether you have operands on both sides. The unary minus will always be preceded by nothing or another operator. That does mean that a language using - for both unary minus and the subtraction operator is not actually a purely context-free grammar.
Thank you so much for the videos, it's really profound. I have one question: On slide's third statement of Dangling else, can you please explain automatic match part
What is meant is just that many languages (including Java and C/C++) take an ambiguous if-else and just automatically match the else to the most recent if. So if I have if (condition1) if (condition2) doStuff1(); else do Stuff2(); the else will match up to the second if, not the first. If both conditions are true, we call doStuff1(). If the first is true and the second is false, we call doStuff2(). If the first condition is false, we do nothing. I hope that helps.
Thanks. I'm glad it was helpful. The next video will be on hashing in the data structures playlist, but there will eventually be more on programming language concepts
This channel deserves more views and subscribers.
Thank you for the compliment. I'm glad you're finding it useful.
I'm finding your videos to be extremely clear and helpful, thank you!!
Glad to hear it.
Dr.Califf, your video is so amazing and extremely helpful! Thank you so much for your work, and I am so appreciate!
I'm glad you found it helpful. I appreciate the kind words.
I wish that my UNI teacher were as passionate and good at teaching as you are.
Liked and subbed.
I appreciate the compliment.
If Texas Tech had professors like you I'd be programming spaceships to Mars. Your videos are great thanks!
I'm glad you found the videos helpful.
Thank you for the video, really appreciate it.
Glad it was helpful!
I’m finding this series to be a very helpful supplement to Compiler Construction by Niklaus Wirth
I'm glad. These few grammar videos provide some things that are foundational for building a compiler.
I find your videos very helpful
I'm glad.
I need to know when do we include "term" and "factor" in the parse tree and how are they used.
That is purely a matter of looking at the grammar. Each parent and its children must match one of the rules for that nonterminal. And reading across the leaves of the tree from left to right, you must have the "sentence" that you're trying to parse. If both of those things are true, you have a correct parse tree.
Nice video!
Thanks!
Thank you for the super helpful content! I’m finding some difficulty on deciding how to correctly disambiguate and parse unary and binary operators, or infix and prefix/suffix
Specifically the minus and negation operator (-)
Do you have some insights or resources I can consult to better understand how to disambiguate them?
Telling unary minus from binary in an infix setting is usually straightforward, because it's a matter of whether you have operands on both sides. The unary minus will always be preceded by nothing or another operator. That does mean that a language using - for both unary minus and the subtraction operator is not actually a purely context-free grammar.
You make really good content. Well done
I appreciate that!
Thank you so much for the videos, it's really profound. I have one question: On slide's third statement of Dangling else, can you please explain automatic match part
What is meant is just that many languages (including Java and C/C++) take an ambiguous if-else and just automatically match the else to the most recent if. So if I have
if (condition1)
if (condition2)
doStuff1();
else
do Stuff2();
the else will match up to the second if, not the first. If both conditions are true, we call doStuff1(). If the first is true and the second is false, we call doStuff2(). If the first condition is false, we do nothing.
I hope that helps.
Thank you so much🙏, it really helped me to understand ... (^_^). I hope you upload the next video soon.
Thanks. I'm glad it was helpful. The next video will be on hashing in the data structures playlist, but there will eventually be more on programming language concepts