[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
benefits of SRE syntax
- To: srfi-115@xxxxxxxxxxxxxxxxx
- Subject: benefits of SRE syntax
- From: Michael Montague <mikemon@xxxxxxxxx>
- Date: Wed, 16 Oct 2013 11:44:40 -0700
- Delivered-to: srfi-115@xxxxxxxxxxxxxxxxx
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject :content-type:content-transfer-encoding; bh=6DoUsupSDbvfU7VY0eujgu8RI5mjIKpix0sTDpw85I4=; b=FbjvVGFTXxF8EVIbxbjT/fMRsj9cdHOr9Dnurfzkhkrq9qbu1Gf8/xyuQK/MKBL+ix EeCrP1CYUPeDHNliP0v+R1aMPwwubpgjLHEZc2/lx7ou9bENcM4zmpC7vGPRyK4QAzIk GoOO47Rmx1oWgMVX+W0zKshna6peaxWGznJ6ddtYFo6lyb8Duo1vflVaXNTrYJpqV1P/ SurNq79oZP35jQU7BAcUkNvY9kD67RzT0ouO0mzL41Mbc33fRa4EyYjHVlG+EvIYSxZf HyurbfQ+NkF8bkMJNurp5qqJvmOgm5rh/jCt1Gg31ruiSf5i+oWJBndyro1XbZhIPEh3 z7fg==
- User-agent: Mozilla/5.0 (Windows NT 6.2; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0.1
Maybe I am being a heretic, but what are the benefits of the SRE syntax?
The beginning of the rational notes that "regular expressions are the
lingua franca of string matching today". Part of that lingua franca is
the traditional syntax of regular expressions.
The rational also lists three benefits of the SRE syntax:
(1) They are easier to read.
(2) They are easier to extend.
(3) They are both faster and simpler to compile.
On benefit (1): they are more verbose, and readability is subjective.
They will look different to anyone who has already learned the
traditional syntax of regular expressions.
On benefit (3): some (most?) implementations will compile the SREs to
the traditional syntax and use a library like PCRE.
I don't have a sense for the value of benefit (2), maybe it is enough to
make the SRE syntax worth it. Benefits (1) and (3) don't seem like
strong enough arguments to merit requiring the SRE syntax.