www.au.dk

Exercises Week 37

www.au.dk
dOvs
DAIMI / Courses / dOvs

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

  2. Write a SableCC grammar that parses simple regular expressions.

  3. Consider a 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