W3C home > Mailing lists > Public > www-svg@w3.org > April 2000

Re: Comma delimited lists in SVG

From: Chris Lilley <chris@w3.org>
Date: Thu, 06 Apr 2000 13:34:08 +0200
Message-ID: <38EC7630.4E470B88@w3.org>
To: Dan Connolly <connolly@w3.org>
CC: www-svg@w3.org

Dan Connolly wrote:

> If you're willing to live with a restriction that your EBNF is
> a regular grammar, and hence can be converted to a regular expression,
> you *can* do that with schemas.

That might be OK if the EBNF can be converted to regexp automatically.
Maintaining regexps is something I am not willing to get into, but
auto-converted EBNF should be OK.

> Let's see if this works in the case of the SVG path element...
> Hmm... yes, it seems regular. I don't see any recursion.

Correct, there isn't any.

> Let's see if I can encode this as a regexp...
> |svg-path:
> |                 wsp* subpaths? wsp*
> gives
>         \s*{subpaths}?\s*
> ... combined with
> |subpaths:
> |                 subpath
> |                 | subpath subpaths
> we get
>         \s*{subpath}*\s*
> hmm... seems to be
>         \s*{[Mn]\s*{coord-pair}(,\s*{lineto-argument-sequence})?}*\s*

OK so as this progresses we get the entire thing built up on one line as
one regexp. What would be the performance implications of that huge and
hairy expression? EBNF at least allows the normal computer programming
practice of divide and conquer. Does regexp in effect require "the whole
program in a single function"?

> then let's see... the number syntax makes for a bit of a hairy
> regexp:
>         (-?(\d+|(\d+?\.\d+([eE]\d+)?)
> or something like that.
> Anyway... I think it can be done.

Noting that you stopped there (although, thanks for pointing the way), I
draw the conclusion that this would take a bit of effort, and might not be
provably the same grammar. Does anyone have an EBNF to regexp compiler or
other tools that would automate this?
> > > With the exception of the color datatype, I'd suggest that the definition of all these attributes
> > > be changed to strictly space-separated lists.
> >
> > We might have to look at doing that if that is all that XSchema gives us.
> > However, I live in hope that XSchema improves.
> I suggest that you stick to space as a separator in the case of
> simple vector lists. For regular constructus, use the pattern facet.

I will look at doing that.

> For more complex stuff (e.g. xpath notation), the schema spec doesn't
> provide any mechanism to express that syntax.


Received on Thursday, 6 April 2000 07:34:10 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 22:53:49 UTC