Re:Designing a Good DSL
by Twisol on Tuesday July 17, 2018 @06:02PM
(#17553852)
Minor nitpick: A{2,4} becomes AA(|A|AA), not AA(A|AA).
[ Parent
| on HN ]
Re:Designing a Good DSL
by jrochkind1 on Tuesday July 17, 2018 @06:51PM
(#17554211)
`AA(|A|AA)` is valid regexp syntax?
Holy moly it is! I had no idea you could put a | right after parens like that! I guess (|A) is nothing or A? Woah.
Yep! It's equivalent to `AA(A|AA)?`, by way of the parent's reduction for `?`, but it's a nice option when you want to emphasize some kind of symmetry.