[relaxng-user] Latest proposal for smart regexes in RELAX NG

jcowan at reutershealth.com jcowan at reutershealth.com
Wed May 5 15:10:11 ICT 2004


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  jcowan at reutershealth.com  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


More information about the relaxng-user mailing list