W3C home > Mailing lists > Public > www-style@w3.org > October 2009

Re: [CSS21] core grammar doesn't generate example in 4.1.6 Blocks

From: Zack Weinberg <zweinberg@mozilla.com>
Date: Wed, 21 Oct 2009 10:57:50 -0700
To: Dan Connolly <connolly@w3.org>
Cc: Bert Bos <bert@w3.org>, www-style <www-style@w3.org>
Message-ID: <20091021105750.788928b0@mozilla.com>
Dan Connolly <connolly@w3.org> wrote:
> You seem to be saying "don't confuse the block production with
> the definition in 4.1.6; the latter is the real definition of
> a block." Well, I am confused. I think the spec is confusing.
> If the names of the productions under core syntax get clobbered
> by text later in the spec, perhaps the core syntax grammar is
> just a distraction.

I agree that this is all really confusing.  It's probably too late for
2.1, but I would like to see a major revision to the grammar definition
that treated the core syntax and tokenization as primary.  All the
productions with semantic meaning would be treated as refinements of
the core parse -- for a small example, given

    a { font-weight: bolder; }

this would be parsed as-if first by the core syntax

     SELECTOR[ ANY[ 'a' ] ] 
       PROPERTY[ 'font-weight' ] ':'
       VALUE[ ANY[ 'bolder' ] ]
     ';' '}'

and then the semantic rules get to match against this partially
parsed tree.  Implementations would, of course, be free to merge the
two phases.  The point of the exercise is primarily to define things in
only one place, but also to emphasize that it's the core syntax that
determines the boundaries of selectors, blocks, etc.

As part of this, the Appendix G grammar should be discarded or replaced
with an exact translation to Lex/Yacc of the core rules (including the
rules for recovering from parsing errors).

(I also want to see the formal grammar be normative and properly
specified for all semantic rules, but that's a separate project.)

Received on Wednesday, 21 October 2009 17:58:30 UTC

This archive was generated by hypermail 2.4.0 : Monday, 23 January 2023 02:13:40 UTC