Re: Latest proposal for smart regexes in RELAX NG

[email protected] Wed, 5 May 2004 15:10:11 -0400
Newsgroups gmane.text.xml.relaxng.general
Message-ID <[email protected]>
Bob Foster scripsit:

> I'm sorry (remember, brain on haitus) but I don't understand what you 
> are saying. This:
> 
>     s-pattern="""
>       comment = "\(([^\(\)\\]|\\.)*\)"
>       atom = "[a-zA-Z0-9!#$%&'*+\-/=?\^_`{|}~]+"
>       atoms = atom "(\." atom ")*"
>       person = "\"([^\"\\]|\\.)*\""
>       location = "\[([^\[\]\\]|\\.)*\]"
>       local-part = "(" atom "|" person ")"
>       domain = "(" atoms "|" location ")"
>       start = "(" comment " )?" local-part "@" domain "( " comment ")?"
>     """
> 
> is not RELAX NG itself. At a glance, it's a context-free grammar. Hence 
> my questions above.

It's not a CFG because recursion is forbidden.  The whole thing can be
re-expressed as a single string, at the cost of perspicacity.

-- 
John Cowan  [email protected]  http://www.ccil.org/~cowan
O beautiful for patriot's dream that sees beyond the years
Thine alabaster cities gleam undimmed by human tears!
America! America!  God mend thine every flaw,
Confirm thy soul in self-control, thy liberty in law!
        -- one of the verses not usually taught in U.S. schools