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

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

   RULESET[ 
     SELECTOR[ ANY[ 'a' ] ] 
     '{' 
     DECLARATION[ 
       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.)

zw

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