CSC 272-Software II : Principles of Programming Languages

Dr. R. M. Siegfried

Assignment #3 - P. 157/Problem Set 2e, 3, 4, 6

Due Wednesday, February 21, 2018

Problem Set 2e

Write the EBNF description for C float literal

Problem Set 3

Rewrite the BNF of Example 3.4 (shown below) to give + precedence over * and force + to be right-associative.

Problem Set 4

Rewrite the BNF of Example 3.4 to add the ++ and -- unary operators of Java.

Problem Set 6

Using the grammar of Example 3.2 (show below), show a parse tree and a leftmost derivation for each of the following statements:

  1. A = A * (B + (C * A))
  2. B = C * (A * C + B)
  3. A = A * (B + (C))

Example 3.4

  
<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <expr> + <expr>
          | <expr>*<expr>
          | (<expr>)
          | <id>

Example 3.2


<assign> → <id> = <expr>
<id> → A | B | C
<expr> → <id> + <expr>
          | <id> * <expr>
          | (<expr>)
          | <id>

[Back to the Assignments List]