Re: additional regular expression operators

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Thu, 16 Apr 2009 16:52:26 GMT

          From comp.compilers

Related articles
[2 earlier articles]
Re: additional regular expression operators zaimoni@zaimoni.com (2009-03-30)
Re: additional regular expression operators haberg_20080406@math.su.se (Hans Aberg) (2009-03-30)
Re: additional regular expression operators torbenm@pc-003.diku.dk (2009-03-31)
Re: additional regular expression operators rpboland@gmail.com (Ralph Boland) (2009-03-31)
Re: additional regular expression operators torbenm@pc-003.diku.dk (2009-04-14)
Re: additional regular expression operators zayenz@gmail.com (MZL) (2009-04-15)
Re: additional regular expression operators anton@mips.complang.tuwien.ac.at (2009-04-16)
Re: additional regular expression operators gah@ugcs.caltech.edu (glen herrmannsfeldt) (2009-04-16)
Re: additional regular expression operators torbenm@pc-003.diku.dk (2009-04-17)
Re: additional regular expression operators mailbox@dmitry-kazakov.de (Dmitry A. Kazakov) (2009-04-17)
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Thu, 16 Apr 2009 16:52:26 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: 09-03-111 09-03-123 09-04-001
Keywords: lex
Posted-Date: 17 Apr 2009 06:10:59 EDT

Ralph Boland <rpboland@gmail.com> writes:
>I have never found a useful example of set intersection though.


FP numbers are typically strings of digits and decimal points that
contain at least one digit and exactly one decimal point. That's a
little more elegant to describe as intersection than as a union; let's
use '&' as intersection operator:


[.0-9]*&.*[0-9].*&[^.]*[.][^.]*


That reflects exactly the specification above, which is not so clear
with the equivalent


[0-9]+[.][0-9]*|[.][0-9]+


Intersections can also be used for a set of things in arbitrary order
and also for a subset of things. For a set (i.e., your R @ S @ T):


(R|S|T)*&R~*RR~*&S~*SS~*&T~*TT~*


For a subset:


(R|S|T)*&R~*R?R~*&S~*S?S~*&T~*T?T~*


- anton
--
M. Anton Ertl
anton@mips.complang.tuwien.ac.at
http://www.complang.tuwien.ac.at/anton/



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.