Learning Goals:
The goal of this video is to explain the fundamental concepts of ambiguity in programming languages. After watching this video, one should be able to recognize how a grammar of a programming language can be ambiguous, and how to resolve this ambiguity by enforcing associativity and precedence in a grammar. This video first gives a short definition of what grammar ambiguity is, and how it can be demonstrated by drawing multiple parse trees for the same string of code. This video also teaches how to write grammars for arithmetic expressions that are unambiguous, by using multiple tokens to force associativity and precedence. Alternatively, this video teaches a method of writing grammars that will eliminate ambiguity by using parse trees directly, and shows how that example might look in the Scala programming language. Finally, this video will give the viewer a broader look at ambiguity by relating it to the bigger picture of computer science, and how ambiguity relates to natural language.