I like using `parse` in Rebol / Red - <a href="http://www.rebol.com/r3/docs/functions/parse.html" rel="nofollow">http://www.rebol.com/r3/docs/functions/parse.html</a><p>Here's the parse rule for Batman:<p><pre><code> [
16 "na"
2 [space "batman"]
]
</code></pre>
And complete example for the Semantic version:<p><pre><code> digit: charset "1234567890"
if parse "0.2.5" [
opt "v"
copy major [some digit]
"."
copy minor [some digit]
"."
copy patch [some digit]
][
print [major minor patch]
]</code></pre>
I made a wiki page for similar alternative regex syntax projects:<p><a href="https://github.com/oilshell/oil/wiki/Alternative-Regex-Syntax" rel="nofollow">https://github.com/oilshell/oil/wiki/Alternative-Regex-Synta...</a><p>(including my own <a href="https://www.oilshell.org/release/latest/doc/eggex.html" rel="nofollow">https://www.oilshell.org/release/latest/doc/eggex.html</a> which is built into Oil)
A bit orthogonal but something I would love to see:<p>A library which takes a regex and shows some examples that pass and some that fail. I would find that the easiest way of understanding a regex, rather than changing the language itself. (Though Melody looks v promising and I'm keen to see it develop).<p>It wouldn't be trivial to build — particularly for the "fail" examples, you'd want them fairly close to passing. For example, with `(/*\.csv\.gz)` you'd want `foo.csv.gz` rather than `aoseutn` as an example of a failure.
Some thoughts I had for the developer:<p>Does it (or are the plans to) reverse compile? If I could input my regex and output melody script one could create an excellent interactive learning tool, and also more selfishly help with adoption in teams with crusty old devs like me who like our magic rituals and prefer typing our regex by hand.<p>Also are there plans to support runtime compiling in JS? Something like...<p>someMelodyObject = <initialise and configure melody>
String.replace(someMelodyObject.toRegexp(), someString)<p>This I think would make it a compelling library for inclusion into projects assuming it were fairly efficient and lightweight. Not sure how or if you'd have to deal with performance and caching but it would probably go a ways to improving adoption among web developers at least.<p>Anyways good luck with the project. Regex is often considered a dark art when it's actually fairly concise and expressive, opening it up to more people at a higher level could lead to greater understanding of regex in general. Also what an interesting and challenging project to undertake, definitely a nontrivial challenge all told.
I always liked the Perl style commented regexes, would be nice if this could generate those, though I guess that needs language support.<p><a href="https://stackoverflow.com/questions/15463257/commenting-regular-expression" rel="nofollow">https://stackoverflow.com/questions/15463257/commenting-regu...</a><p>Some interesting workarounds mentioned here that might pair well with melody type languages.<p>A way to specify example strings that match or don't as a mini unit test would be cool too.
I have never taken the time to learn RegEx stuff. It seems like it would be great if I could keep all the syntax in my head. So the idea of Melody seems great. I don't like that the github description claims it to be unstable currently. I hope this project continues and flourishes.
Shameless plug: I'm working on a similar project, with a strong focus on providing a painless migration path. Author: let's chat and perhaps join forces?<p>Please don't submit to HN until I release the vscode plugin :-)<p><a href="https://github.com/sonoflilit/kleenexp" rel="nofollow">https://github.com/sonoflilit/kleenexp</a>
So, a RegEx (melody syntax) to RegEx (unspecified syntax) compiler? I mean, the syntax is nice, but 1. please specify which kind of regular expression it compiles to, 2. are those really regular expressions or a language higher in the chomsky hierarchy? 3. I suggest to add a graphical output of the state machine, e.g. with graphviz.