regexp for reg language that has an even number of a's and b's

regexp for reg language that has an even number of a's and b's

Post by jaialai te » Fri, 02 Feb 2007 13:50:34


I am looking for a regexp that describes a language over {a,b}*
tsuc that each element contains an even number of a's and b's.
Does this regexp work?
My regexp---> (aa+bb)*
 
 
 

regexp for reg language that has an even number of a's and b's

Post by Barb Kno » Fri, 02 Feb 2007 17:30:18

In article < XXXX@XXXXX.COM >,



That misses abba, ababbb, etc.

You might try first writing a DFA for the language, then convert that to
a regexp. The DFA will need 4 states.

--
---------------------------
| BBB b \ Barbara at LivingHistory stop co stop uk
| B B aa rrr b |
| BBB a a r bbb | Quidquid latine dictum sit,
| B B a a r b b | altum viditur.
| BBB aa a r bbb |
-----------------------------