Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: anton@mips.complang.tuwien.ac.at (Anton Ertl) Newsgroups: comp.compilers Subject: Re: syntax complexity Date: Tue, 21 Feb 2023 18:39:55 GMT Organization: Institut fuer Computersprachen, Technische Universitaet Wien Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-02-059@comp.compilers> References: <23-02-045@comp.compilers> <23-02-047@comp.compilers> <23-02-050@comp.compilers> <29156_1676600565_63EEE4F4_29156_1009_1_23-02-051@comp.compilers> <23-02-052@comp.compilers> <23-02-053@comp.compilers> <23-02-055@comp.compilers> Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="31324"; mail-complaints-to="abuse@iecc.com" Keywords: syntax, lex Posted-Date: 22 Feb 2023 02:13:28 EST X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3398 anton@mips.complang.tuwien.ac.at (Anton Ertl) writes: >Regular expression syntax is missing an operator that signifies the >intersection of the sets recognized by the operand regexps. Let's >call this operator "&". Then this requirement for an FP number can be >expressed as: > >([0-9.]*&.*[0-9].*)(E[0-9]+)?&.*[.E].* ... >[Wouldn't that pattern allow 1.2.3 ? -John] Good point. The & operator makes it easy to fix this bug (once you have found it): ([0-9.]*&.*[0-9].*)(E[0-9]+)?&.*[.E].*&[^.]*[.]?[^.]* But it suggests that I tried to put too many requirements into the first part, so let's try again: At most one "." in front of at most one "E": [0-9]*[.]?[0-9]*E?[0-9]* At least one of "." or "E": .*[.E].* At least one digit in front of and after "E": .*[0-9].*E[0-9]+ In total: [0-9]*[.]?[0-9]*E?[0-9]*&.*[.E].*&.*[0-9].*E[0-9]+ - anton -- M. Anton Ertl anton@mips.complang.tuwien.ac.at http://www.complang.tuwien.ac.at/anton/