English subtitles

← 03-34 Finding Ambiguity Solution

dummy description

Get Embed Code
3 Languages

Showing Revision 1 created 05/04/2012 by Amara Bot.

  1. Let's go through these and find an example
  2. I'm going to focus my attention here.
  3. This could either be 1 minus 2 minus 3 or 1 minus 2 minus 3.
  4. This ends up being 2--1 minus -1.
  5. This ends up being -4.
  6. Very different answers.
  7. The parse tree for this interpretation looks a bit like this.
  8. It's left heavy with this other subtraction--1 minus 2--down and to the left.
  9. Over here the parse tree would be right heavy.
  10. Now, I'm not drawing all the nodes in the parse tree just to save a bit of time.
  11. Mostly, I'm highlighting its shape.
  12. This is an example of a string that has more than one parse tree in our grammar.
  13. Similarly, this bigger string has more than one parse tree in our grammar.
  14. It might even have four different parse trees, possibly even more.
  15. You'd have to try that and find out.
  16. Notably, it contains 1 minus 2 minus 3 as a subpart.
  17. Even if this -4 at the end is perfectly unambiguous,
  18. it still has exactly the same problems we saw here.
  19. It still has at least two parse trees.
  20. It's even worse than its friend two lines above.
  21. If you look carefully, all of the other examples don't demonstrate ambiguity.
  22. Each one of these has exactly one parse tree.
  23. Even this big complicated thing at the bottom only has one parse tree.
  24. It's perfectly balanced--1 minus 2 on the left, 3 minus for on the right.