Re: ireegular expressions, syntax complexity

anton@mips.complang.tuwien.ac.at (Anton Ertl)
Wed, 22 Feb 2023 10:55:21 GMT

          From comp.compilers

Related articles
syntax complexity gah4@u.washington.edu (gah4) (2023-02-15)
Re: syntax complexity DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2023-02-16)
Re: syntax complexity gah4@u.washington.edu (gah4) (2023-02-16)
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 anton@mips.complang.tuwien.ac.at (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: Wed, 22 Feb 2023 10:55:21 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 23-02-059
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="77041"; mail-complaints-to="abuse@iecc.com"
Keywords: syntax, lex, comment
Posted-Date: 22 Feb 2023 12:03:11 EST

anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>anton@mips.complang.tuwien.ac.at (Anton Ertl) writes:
>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]+


There's still a bug here, because that makes "E" non-optional. Let's
make it optional:


At least one digit, when using E one before and one after: .*[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/
[This doesn't seem all that much simpler than the usual approach with
alternation, give or take bugs:
    ([0-9]+\.[0-9]*|\.[0-9]+)(E[0-9]+)?|[0-9]+E[0-9]+
-John]


Post a followup to this message

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