lexical description problem in language report?
Ross Paterson
ross@soi.city.ac.uk
Thu, 2 Aug 2001 18:17:35 +0100
On Tue, Jul 24, 2001 at 10:50:16AM -0700, Thomas Hallgren wrote:
> Although qualified names are listed in section 2.4,and in appendix B,
> the two first productions of the grammar are:
>
> 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".
Similarly, in 4 and 4.4.2, we have
gendecl -> fixity [digit] ops
but digit isn't in the list of lexemes in 2.2 and B.2, nor is it
reasonable for it to be there. I suggest
gendecl -> fixity [integer] ops
with the value of the integer constrained to be between 0 and 9 inclusive.
Incidentally, this is what GHC, Hugs and NHC do, in that they accept
infix 0x0003 !$%
as equivalent to
infix 3 !$%
presumably because doing what the Report says would be rather awkward.