Computer Science 5641
Compiler Design
Homework Assignment 2 (20 points)
Due October 8, 2002

Consider a language defined by the following syntax:

Answer the following questions:

  1. [3] Write a context-free grammar for the language using only one nonterminal.
  2. [3] Is your grammar ambiguous? Explain your answer.
  3. [6] Update your grammar to make a grammar that accounting for the following requirements (you may use as many nonterminals as you like):
  4. [3] Show a right-most derivation and corresponding parse tree for 1/3-4**5--2.
  5. [4] Determine the first and follow sets for your grammar. Using your sets construct a parse table for a predictive parser.