CS412/413
Introduction to Compilers and Translators
Spring 1999
Homework 2: Parsing
Due: February 19, 1999 at the beginning of class
- [#1] For # 1, are sentences like, "Like a banana, time flies"
allowed in the language generated by this grammar?
This form of sentence is not in the language specified in the textbook because it involves
a comma. The only form of punctuation should be a semicolon (we'll ignore the need for a
terminating period).
- [#1] Is my grammar incorrect or am I not seeing how to derive an
ambigous sentence?
An example of two ways to parse the ambiguous sentence "Fruit
flies like fruit":
- Subject - Verb - Simile: ("Fruit", "flies", "like fruit")
- Subject - Verb - Object: ("Fruit flies", "like", "fruit")