[erlang-questions] Adoption of perl/javascript-style regexp syntax

Richard O'Keefe ok@REDACTED
Wed Jun 3 07:03:39 CEST 2009


On 3 Jun 2009, at 4:08 pm, Tony Arcieri wrote:
>
> You can read a little bit about the regex syntax at:
>
> http://wiki.reia-lang.org/wiki/Data_types#Regular_expressions

How very limiting.

No, not Reia.  Just AWK-style regular expression literals.
They weren't good enough for AWK, which allows you to compute
regular expressions as strings and then use them.  (I don't
know about other AWKs, but mawk caches the compiled form, so
that using the same string repeatedly as a pattern doesn't
result in repeated recompilation.)  Of course, computing
regular expressions as strings is about as straightforward as
representing biological pathways in Excel spreadsheets...
AND IT ISN'T JUST STRING LITERAL SYNTAX THAT MAKES THIS SO.
(That's not Reia's fault.  It isn't Erlang's either.)

There are several stages in the compilation of a regular
expression, at least notionally:
	linear representation -> AST
	AST -> matching engine
It's good that Reia has a clue about regular expression literals
(as AWK did).  It would be even better if it _also_ provided an
API for the AST, so that one could say
	"I want that regular expression followed by this string
	 followed by that regular expression."
It would be nice to tag the matches one wants with atoms rather
than invisible integers.  And so on.



More information about the erlang-questions mailing list