Re: CSS draft 4.0 [Level 2 YACC Spec]

Bert Bos (Bert.Bos@sophia.inria.fr)
Mon, 23 Oct 1995 13:16:46 +0100


Glenn Adams writes:
> While I'm on the subject of LEX/YACC specs, I don't know if anyone has
> tried it, but the level 2 YACC spec in the 4.0 draft is in serious need
> of repair. Besides a variety of typos, the following productions
> produce a variety of problems:
>
> 1. imports: imports IMPORT url
>
> This rule prevents any rule from applying. Change to:
>
> imports: imports IMPORT url | /* empty */;

OK

> 2. term: length | STRING | HEXCOLOR | NUMBER | IDENT | attref | propref |
> ENVVAR | '(' value ')';
>
> Here propref conflicts with IDENT. Change to:
>
> term: length | STRING | HEXCOLOR | NUMBER | IDENT | attref |
> ENVVAR | '(' value ')';

OK. (Actually, we need another terminal in there, PERCENTAGE, because
we decided to treat a percentage as a type of its own, instead of as a
number.)

> 3. op: '+' | '-' | '*' | '/' | INTERPOLATEHI | INTERPOLATELO | /* empty */;
>
> Produces 2 shift/reduce conflicts. Change to:
>
> op: '+' | '-' | '*' | '/' | INTERPOLATEHI | INTERPOLATELO;

As you already noted in your other message, this conflict is
unavoidable, since we want the absence of an operator to mean
concatenation (or rather, list construction). Just put "%expect 2" at
the top of the yacc/bison file. Yacc wil shift rather than reduce,
which is what you want in this case.

Like with the (f)lex specification, we have a correct, tested grammar,
but it failed to make it into the 4th draft. We'll include it as soon
as possible.

We changed some of the names of the nonterminals as well, to bring
them more into line with the terminology used elsewhere in the draft.

Bert