2.0 Introduction

2.1 Grammars

2.2 Ambiguity

2.3 Summary

Web References

Exercises

Module 2 Exercise Solutions 

     1. (a)

    (b)

    (c)

    (d)


  1. An interpretation is: time as an imperative verb: to time (using a clock) flies the same way arrows are timed (clocked).

  2.  
  3. The string "1 2 3" has more than one parse tree:

  4.  

    An unambiguous grammar which generates the same set of strings is:

    
       Number -> Digit  |  Digit Number
       Digit ->  0 | 1 | 2 | 3 | ... | 9
    


  5. (a) Strings of balanced parentheses (including none)

  6. (b) Not ambiguous
    (c) Not left recursive