CSC 272-Software II : Principles of Programming Languages

Dr. R. M. Siegfried

Assignment #4 - p. 200-201/ Problem set 5, 6 and a Top-Down Parsing Problem

Due Monday, March 26,2018

Problem Set 5

Given the following grammar and the right sentential form, draw a parse tree and show the phrases and simples phrases, as well as the handle.

S → aAb | bBA       A → ab | aAB      B → aB | b

  1. aaAbb
  2. bBab
  3. aaAbBb

Problem Set 6

Given the following grammar and the right sentential form, draw a parse tree and show the phrases and simples phrases, as well as the handle.

S → AbB | bAc       A → Ab | aBB      B → Ac | cBb | c

  1. aAcccbbc
  2. AbcaBccb
  3. baBcBbbc

Top-Down Parsing Problem

Using the following parse tree for the following grammar, create a parse tree for the phrases below:

LL(1) Parse Table
A B C
a - - -
b 2 - -
d 1 3 -
e 1 4 -
f - - -
g - - 5
h - - 6
$ - - -

A → Ba | bC       B → d | eBf       C → gC | h

  1. eedffa
  2. bggh

[Back to the Assignment List]