Re: Issues with CSS21 grammar (CR 20070719)

On Mon, 10 Aug 2009, Bert Bos wrote:

> I've tried to improve the grammar of appendix G and I think I now have a
> version that defines the same language as before, but is LL(1). It has
> no ambiguities and no nullable non-terminals (except for the start
> symbol: "stylesheet" can of course still be empty).
>
> Compared to the last edits in response to Yves's suggestions, I've only
> further changed "selector" and "combinator".
>
> I'd like the grammar of appendix G to be as useful as possible, even
> though I know not many programs can use it. (Maybe it serves a
> validator, but all other programs will have to accept the forward
> compatible grammar instead.)
>
> I'd like to ask especially Andrey and Yves to take a look...

as you wish. i take a look. looks good...
but it's just an impression. errare humanum est.

antlr claim it LL(1), but i currently can't verify LARL(1),
the more confirm it defines same language as before.

if you decide to change spec, i also ask to evaluate following changes:

1. replace '[]' grammar notation with '()' notation.
    then grammar can be used in antlrworks 'as is', making life with
    it easier.
2. replace comment sentention about color with token regexp, i.e.
/*
  * There is a constraint on the color that it must
  * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F])
  * after the "#"; e.g., "#000" is OK, but "#abcd" is not.
  */
    looks stupid in grammar. see e.g. 'hexcolor', 'HEX' in
    http://trac.webkit.org/browser/trunk/WebCore/css/tokenizer.flex,
    http://trac.webkit.org/browser/trunk/WebCore/css/CSSGrammar.y

>
> I tested the grammar with an LL(1) parser generator and, after carefully
> expanding the rules, with Yacc. And it seems to work: neither complains
> about ambiguities and the resulting programs accept my various tests.
>
>
>
> Bert
>

Received on Wednesday, 12 August 2009 14:18:00 UTC