jellylanguage icon indicating copy to clipboard operation
jellylanguage copied to clipboard

Syntax for regex operations

Open lynn opened this issue 5 years ago • 0 comments

#56 suggests some new atoms that perform regex operations, but perhaps it'd be better to introduce a new kind of "string start" that syntactically starts a regex, with its own set of terminators that each corresponds to a regex operation.

This would be a good use for (, which doesn't have meaning yet.

For example, #56 proposes

œF: Regex Findall: Find all instances of regex x in string y; return a list of matches

And “[a-z]”œF is 9 bytes, but something like ([a-z]Ḟ is only 7. (Here would be the regex terminator for “findall”).

Instead of “[a-z]+”UÐR, we'd write U([a-z]+Ṙ. So is a regex terminator that makes the result act as a quick.

It also makes sense to introduce all kinds of “macros” within the regex syntax. For example, could be short for [a-z], and ¹ for \1. And of course, Ɗ makes a (...) group out of the previous three regex tokens.

lynn avatar Sep 02 '20 13:09 lynn