COEN 171

Principles of Programming Languages

Winter 2000

 

Homework 1

DUE: Thursday, January 20

 

Page 34, number 8

 

I.  Consider the grammar given below

            <pop>    ::=      [ <bop> , <pop> ]  |  <bop>

            <bop>    ::=      <boop>  |  (  <pop>  )

            <boop> ::=       x  |  y  |  z

 

    (a)    What are the nonterminal symbols?

 

    (b)    What are the terminal symbols?

 

    (c)    What is the start symbol?

 

    (d)    Draw a parse tree for the sentence (x).

 

    (e)    Draw a parse tree for the sentence [(x),[y,x]].

 

Page 152 ff, numbers 2c, 3a, 5, 7, 10, 13a, 14a, 16