CS 456/656 Assignment 4

Due date: November 17, 2005, 4:00 PM.

All assignments must be handwritten (not typed or printed from a computer file) in your own handwriting, on 8.5 by 11 inch paper, or on A4 paper. Write your name on each sheet, and do not fold the pages or crimp the corners. (You may use a paper clip or a staple.)
Turn the pages in to me or to the graduate assistant on or before the due date.
  1. Let Sigma = {a,b,c,d,e,(,),!,&,|,=,<}. Let Lbool be the language consisting of all strings over Sigma which are valid Boolean expressions in C++, under the assumption that all variables are declared to have Boolean type, using only these operators. Errors in precedence now corrected. Some examples.
    Design an unambiguous context-free grammar for Lbool. One of the variables of your grammar should be V, and these productions should be part of your grammar.
    Your grammar must respect the semantics of Boolean expressions, as defined in C++. This means that, given any assignment for any expression, the value of the expression can be found by bottom up computation in the parse tree. Remember that, in C++, all the binary operators I have listed are evaluated in left-to-right order.

Back to Course Page