This is an old revision of the document!
11. Closure properties for Context-Free Languages
11.0. Lexer Spec
Given the following specs, construct the lexer DFA as presented in Lecture 14:
- PAIRS: $ (10 | 01)* $
- ONES: $ 1+ $
- NO_CONSEC_ONE: $ (1 | \epsilon)(01 | 0)* $
Separate the following input strings into lexemes:
a) 010101
b) 1010101011
c) 01110101001
d) 01010111111001010
e) 1101101001111100001010011001
11.1. Not Closed under CFLs
11.1.1. Intersection is not a closure property.
11.1.2. Complement is not a closure property.
11.1.3. Difference is not a closure property.
11.2. Closed under CFLs
11.2.1. Concat is a closure property.
11.2.2. Union is a closure property.
11.2.3. Kleene Star is a closure property.
11.2.4. Reverse is a closure property.
11.2.5. Intersection with a regular language is a closure property.
11.2.6. Difference with a regular language is a closure property. <hidden Solution 11.2.6.> Let \( A \) be a context-free language and \( B \) a regular language. \hat{B} is regular, as complement is closed under regular languages. From 11.2.5 we know that the intersection is closed betwwen CFLs and Regular Languages, and write A \ B as A \cup \hat{B}.