Related articles |
---|
[?] Closure variables in regular expressions qjackson@wave.home.com (Quinn Tyler Jackson) (1999-06-19) |
Re: [?] Closure variables in regular expressions jonathan_barker@my-deja.com (1999-06-27) |
From: | jonathan_barker@my-deja.com |
Newsgroups: | comp.compilers |
Date: | 27 Jun 1999 00:02:42 -0400 |
Organization: | Deja.com - Share what you know. Learn what you don't. |
References: | 99-06-071 |
Keywords: | lex, comment |
"Quinn Tyler Jackson" <qjackson@wave.home.com> wrote:
> There are regular expression extensions that do this:
>
> [a-z]{1-32}
>
> Has anyone ever seen regular expression extensions that work like
this?
>
> [a-z]+:n %{n}
>
> What this would do is match 1 to many from the character set 'a-z',
> and store how many times it did so into n. Then, it would match only
> that many of the literal '%'...
>
> Any pointers to theory to suggest this would be useful or useless?
Forgive my ignorance if need be... It seems to me that there is a
difference between your example of existing extensions and your
proposed extension. [a-z]{1-32} represents a regular language whereas
I would have thought that [a-z]+:n%{n} does not. One can construct a
DFA which recognises the first expression, but I have a feeling that a
PDA would be needed to recognise the second. Thus the theory you seek
is probably that of higher order languages and their grammars.
Apologies if I'm talking nonsense, or if I've missed the point
entirely...
All the best
Jonathan
[You're right. DFAs can't match parens or do any other counting. -John]
Return to the
comp.compilers page.
Search the
comp.compilers archives again.