G22.2110-001 Programming Languages

Homework 1 - Due May 26

  1. Draw a leftmost derivation tree for the following Java Expression:  a = (b + 1) * 2   Use the Java Grammar from the Java Language Specification (first edition), which is available on the web at http://java.sun.com/docs/books/jls/first_edition/html/19.doc.html .  Be sure to annotate the internal nodes of the tree with the names of the appropriate non-terminals.
  2. Write a BNF grammar that accepts the language of nested parentheses and angle brackets.  Your grammar should accept  (<>)(), for example, but should not accept (<)>().