1. Consider the ambiguous grammar on slide 13. How many parse trees are possible for the string x-x*y+z?

    parsetrees

  2. Consider a lexer/scanner defined by the following sequence of regular expressions:
    "abba"
    [ab][a]*b
    [ab][b]+a
    [a-z]
    
    Which tokens are generated for the following input string?
    abbabbbbaaaabbbababacbbbbbaaabbbabba
    
    tokens

  3. Consider the ambiguous grammar of OCaml's match-with expressions given here.

    Give an example of an exp which is ambiguous and resolve the shift/reduce conflict.

    parser

  4. Write an ocamlyacc grammar that parses simple regular expressions.

    regexp-amb, regexp-unamb