lexical description problem in language report?
I believe I've found a problem, or at least a confusion, in the Haskell 98 Language Report. The section on lexical structure seems to use the term "lexeme" in an inconsistent way. "lexeme" is one of the productions in the lexical grammar in section 2.2, but the term is also used in section 2.3 where it is claimed that the string "{-" is a lexeme. However the string "{-" cannot be produced by the given grammar production. Is section 2.3, and the discussion of the maximal-munch rule, using the term lexeme in a different way than the grammar production in section 2.2? If so, maybe a new term should be introduced such as "rawlexeme", with a production like: rawlexeme -> lexeme | opencom | closecom | dashes Then perhaps the maximal-munch rule could be described in terms of "rawlexeme". Any thoughts? -- Gary
Memovich, Gary wrote:
... in section 2.3 where it is claimed that the string "{-" is a lexeme. However the string "{-" cannot be produced by the given grammar production. ...
There seems to be a similar problem with qualified identifiers. The production for lexeme includes varid, conid, etc, rather than qvarid, qconid, etc. (Perhaps someone forgot to update it when qualified names were introduced, in Haskell 1.3...) This might lead you to believe that qualified names are part of the context-free syntax rather than the lexical syntax, and hence that spaces are allowed in them. Qualified names are discussed briefly near the end of section 2.4, but their lexical properties are not explained here. Instead the reader is refered to section 5.3. This reference probably meant to lead to 5.5.1, where the text makes it clear that qualified names are part of the lexical syntax. The same problem is present in Appendix B. Suggestions: include qvarid, qconid in the production for lexeme. Move the explanation of the lexical properties of qualified names from section 5.5.1 to section 2.4. Thomas Hallgren
participants (2)
-
Memovich, Gary -
Thomas Hallgren