Changes between Version 1 and Version 2 of FixityResolution


Ignore:
Timestamp:
Jan 25, 2006 3:05:15 PM (8 years ago)
Author:
simonmar@…
Comment:

expand as per John G.'s request

Legend:

Unmodified
Added
Removed
Modified
  • FixityResolution

    v1 v2  
     1This is a proposal that doesn't affect anything except the presentation of the report, because all Haskell implementations currently do it this way anyway.  There are some legal Haskell programs, according to the report, that aren't accepted by current implementations (see below).  I propose we make the language specification match the implementations. 
     2 
     3== The Problem == 
     4 
    15The Haskell 98 context-free syntax includes fixity resolution as part of the grammar, with a fixed number of fixities ([1..9]), essentially using macro expansion to define the grammar.  Apart from being really ugly, and not corresponding to any known implementation (long ago GHC used a yacc parser formulated like this, but not any more), this gives rise to some constructions that are very hard to parse correctly.  For example, the expression: 
    26 
     
    1721This is legal syntax, and parses as {{{do { a == b } == c}}}, again because {{{==}}} is nonfix, and the second {{{==}}} closes the layout context by virtue of the layout rule's parse error condition. 
    1822 
    19 As far as I know, no Haskell compiler gets this right. 
     23As far as I know, no Haskell compiler gets this right.  
     24 
     25== The Solution == 
    2026 
    2127These constructions rely on the parser being aware of operator fixities during parsing, which is an unreasonable restriction - it's often easier to follow imports after parsing a file, rather than during it.