Show HN: Luna is a Clojure domain specific language that translates to regex
1–10 of 22 posts
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#2[a-z] means a to z
x* means 0 or more xs
...
The problem is that
a) whitespace is significant, so long regexes start to become unreadable
b) no easy way to nest regexes
Perl 6/Raku seemed to solve this by making whitespace meaningless by default and allowing regexes to be nested into other regexes or entire "grammars".
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#3I think this bumps JWZ's problem counter to 3..
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#4Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#5Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#6EDIT: This comment is wrong, I've mistakenly read `(?<=y)x` as `(?=y)x` and wrongly determined the key ":after" is incorrect when writing this comment.
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#7I'm not totally convinced by these English-like regex languages. Regex itself seems like a reasonable language: [a-z] means a to z x* means 0 or more xs ... The problem is that a) whitespace is significant, so long regexes start to become unreadable b) no easy way to nest regexes Perl 6/Raku seemed to solve this by making whitespace meaningless by default and allowing regexes to be nested into other regexes or entire…
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#8EDIT: This comment is wrong, I've mistakenly read `(?<=y)x` as `(?=y)x` and wrongly determined the key ":after" is incorrect when writing this comment.
I’m confused. Given a string “foobar”, `(?<=foo)bar` should match “bar”. Or is this implicitly `^(?<=foo)bar$` in Clojure? I used to know the answer but it’s been several years since I’ve used Clojure.
Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#9Re: Show HN: Luna is a Clojure domain specific language that translates to regex
#10 ;compiled at run time
(re/or #"a" (re-pattern "b"))
=> #"(a|b)a"
;compiled at macro time
(re/or #"a" (re/and #"b"))
=> #"(a|(b))"
https://github.com/coltnz/re-ext