Re: [css3-page] Error in grammar of section 3.4.1

Le 23/04/2012 17:41, Werner Donné a écrit :
> I have one more remark about the production you propose. It is, of
> course, correct, but it isn't LL, because there is a choice conflict
> between the two groups. It is also not easy to transform into an
> LL(k) production, because the required number of look-ahead tokens is
> infinite. I don't know if LL is a requirement, but it would rule out
> a top-down parser if it isn't. Flute, for example, is implemented
> with JavaCC, which expects an LL(k) grammar.

Indeed.


I tried and failed to make it LL(k), starting with the following ideas:

"""
Another way to look at it is a list of margin rules separated by an 
optional list of ';'-separated declarations.

Also, make each declarations optional so that '{;' ';;' and ';}' are 
allowed.
"""

I got a dozen different grammar, but each either was still not LL(k) or 
did not match some input that it should have.

I did not have a formal process for the transformation so I don’t know 
if it *can* be made LL(k).

Alternatively, we could define the syntax in terms of a state machine 
rather that a grammar, as Tab is doing in css3-syntax. (This is 
apparently a better fit for the precise rules of error handling.)

Regards,
-- 
Simon Sapin

Received on Monday, 23 April 2012 18:39:57 UTC