lexical description problem in language report?

Christian Sievers sievers@ips.cs.tu-bs.de
Tue, 24 Jul 2001 21:44:32 +0200 (MET DST)

Thomas Hallgren wrote:

>   program ->  {lexeme | whitespace }
>   lexeme  ->  varid | conid | varsym | consym | literal | special | 
> reservedop | reservedid
> There is no reference to qualified names here. I thought the purpose of 
> these productions were to say that a Haskell program is correct on the 
> lexical level iff there is a derivation of it in the lexical grammar, 
> starting from the nonterminal "program". Since qualified names are not 
> part of this grammar, they are not part of the lexical syntax, which 
> contradicts the text in section 5.5.1.
> So, I repeat my improvment suggestions: include qvarid, qconid, etc, in 
> the production for lexeme. Move the explanation of the lexical 
> properties of qualified names from section 5.5.1 to section 2.4.

You could still parse a qualified name as three lexemes.
Of course you don't want this, as this would allow white space
between them.
For the same reason, you want backquoted functions and constructors
to be only one lexeme. In order to achieve this, just use qop instead
of qvarsym and qconsym. And we need opencom, as the report says {- is
a lexeme.

So I suggest:

  lexeme  -> qvarid  | qconid  | qop
           | literal | special | reservedop | reservedid | opencom

It's all not new. See:

All the best
Christian Sievers