Name _________________________

Proposition Logic and Grammars Worksheet
Chapters 8 and 9
Due Monday, November 8 (25 pts.)

1. Show the derivation tree and the syntax tree for the string "1948" according to the following grammar:

S -> APY | AQZ

A -> D { D }

D -> P | Q

P -> '1' | '3' | '5' | '7' | '9'

Q -> Y | Z

Y -> '2' | '6'

Z -> '0' | '4' | '8'


What is a simple characterization for the strings this grammar generates?

2. Construct a grammar that generates all legal rex lists that contain single-digit leaves. Nested lists should be permitted, but the grammar should not generate other strings. Do not worry about whitespace (assume none). Examples of lists your grammar should generate include

[]

[1]

[1,5,7,0]

[1,[2,3],4,[[5]]]



Consider the 7-segment "decoder":

Seven segment LED display

Display of 0 through 9 with a seven segment display

3. In the following, assume that any digit (0-9) is to be displayed on a 7-segment display. Consider the function that has as input the binary representation of that digit (0-9) and as output, the state of the segments of the seven-segment display. (Lit is 1, unlit is 0.) Create a truth table for this switching function that maps four bits to seven bits.








 

4. Give a Karnaugh map (with don't cares) for each of the switching functions. Write the simplified sum-of-products form of each, taking advantage of "don't cares."




s0:                     s1: 

                     

s2:                     s3: 

                     

s4:                     s5: 

                     

s6: 

 

5. Construct a logic circuit which computes the state of the last segment (s6) in the seven-segment display, given the four bits of input.