{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Module30 - Module 30 EQUAL language Designing a CFG...

This preview shows pages 1–10. Sign up to view the full content.

1 Module 30 EQUAL language Designing a CFG Thinking recursively

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
2 EQUAL language Designing a CFG
3 EQUAL EQUAL is the set of strings over {a,b} with an equal number of a’s and b’s Strings in EQUAL include aabbab bbbaaa abba Strings in {a,b}* not in EQUAL include aaa bbb aab ababa

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
4 Designing a CFG for EQUAL Think recursively Base Case What is the shortest possible string in EQUAL? Production Rule:
5 Recursive Case Recursive Case Now consider a longer string x in EQUAL Since x has length > 0, x must have a first character This must be a or b Two possibilities for what x looks like x = ay What must be true about relative number of a’s and b’s in y? x = bz What must be true about relative number of a’s and b’s in z?

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
6 Case 1: x=ay x = ay where y has one extra b What must y look like? Some examples b babba aabbbab aaabbbb Is there a general pattern that applies to all of the above

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 10

Module30 - Module 30 EQUAL language Designing a CFG...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online