Computer Science 331

Principles of Programming Languages

Programming Assignment #2

"Have a Slurpy"

due Monday, March 17, by 1 p.m.

 

    This program requires you to write a simple recursive descent parser to recognize a fanciful object called a slurpy.  Your program should repeatedly as the user for character strings and print out whether the given string IS or IS NOT a slurpy.  (The definition of a slurpy (and associated slimps and slumps) is given in EBNF below.  Some samples (and non-samples) are also provided.

EBNF

<slurpy> -> <slimp> <slump>

<slimp> -> AH | A (B <slimp> | <slump>) C

<slump> -> (D|E) {F} (<slump> | G)

 

Samples

Sample slumps:  DFG, EFG, DFFFFG, DFDFDFDFDFG

Sample non-slumps: DFEFF, EFAHG, DEFGG

Sample slimps:  AH, ABAHC, ABABAHCC, ADFGC

Sample non-slimps:  ABC ABAH, DFGC, SLIMP

Sample slurpys:  AHDFG, ADFGCDFFFFFG

Sample non-slurpys:  AHDFGA, DFGAH, ABABCC

 

Due Date

You are to mail the appropriate source code to me (at dlevine@sbu.edu) such that I receive it by 1 p.m. on Monday, March 17, 2014.  Any assignments received by 4 p.m. on March 14 will recieve a ten percent grading bonus.

Assignment Type

This is an Individual Assignment, Limited Collaboration as defined in the Department's Academic Policies and Procedures Document.