Re: syntax complexity

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Tue, 21 Feb 2023 18:39:55 GMT

          From comp.compilers

Related articles
[5 earlier articles]
Re: syntax complexity costello@mitre.org (Roger L Costello) (2023-02-20)
Re: syntax complexity gah4@u.washington.edu (gah4) (2023-02-20)
Re: syntax complexity gneuner2@comcast.net (George Neuner) (2023-02-20)
Re: syntax complexity anton@mips.complang.tuwien.ac.at (2023-02-21)
syntax complexity christopher.f.clark@compiler-resources.com (Christopher F Clark) (2023-02-21)
Re: syntax complexity nmh@t3x.org (Nils M Holm) (2023-02-21)
Re: syntax complexity anton@mips.complang.tuwien.ac.at (2023-02-21)
Re: ireegular expressions, syntax complexity anton@mips.complang.tuwien.ac.at (2023-02-22)
| List of all articles for this month |

From: anton@mips.complang.tuwien.ac.at (Anton Ertl)
Newsgroups: comp.compilers
Date: Tue, 21 Feb 2023 18:39:55 GMT
Organization: Institut fuer Computersprachen, Technische Universitaet Wien
References: <AQHZRT1Nf7Ln0mpyG0extuZP9rnVPQ==> 23-02-045 23-02-047 23-02-050 <29156_1676600565_63EEE4F4_29156_1009_1_23-02-051@comp.compilers> 23-02-052 23-02-053 23-02-055
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

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/


Post a followup to this message

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