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

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

View Full Document Right Arrow Icon
1 Module 30 EQUAL language Designing a CFG Thinking recursively
Background image of page 1

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

View Full DocumentRight Arrow Icon
2 EQUAL language Designing a CFG
Background image of page 2
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
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Designing a CFG for EQUAL Think recursively Base Case What is the shortest possible string in EQUAL? Production Rule:
Background image of page 4
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?
Background image of page 5

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

View Full DocumentRight Arrow Icon
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
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 07/25/2008 for the course CSE 460 taught by Professor Torng during the Fall '07 term at Michigan State University.

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 Right Arrow Icon
Ask a homework question - tutors are online