1

i'm struggling to get this regex. I need that to make a DFA, so I prefer JavaCC syntax rather than this.

∑ = {a, b}

L = no more than two identical consecutive symbols.

example: aa abab aabb bbabb bbaabbaab babbaabb

Thanks.

Community
  • 1
  • 1
allnex
  • 335
  • 3
  • 12

1 Answers1

0

If the alphabet is only size two, then the following doesn't require backrefences. I apologize if the syntax isn't quite right: I've not used JavaCC.

("b")? ("b")? ("a" ("a")? "b" ("b")?)* ("a")? ("a")?
Uri Granta
  • 1,814
  • 14
  • 25