cvs commit: fptools/ghc/compiler/prelude PrelNames.lhs fptools/ghc/compiler/typecheck TcGenDeriv.lhs fptools/libraries Makefile fptools/libraries/base Numeric.hs fptools/libraries/base/GHC Read.lhs fptools/libraries/base/Text/ParserCombinators ReadP.hs fptools/libraries/base/Text/Read ...

Simon Peyton Jones simonpj@glass.cse.ogi.edu
Wed, 5 Jun 2002 07:08:25 -0700


simonpj     2002/06/05 07:08:25 PDT

  Modified files:
    ghc/compiler/prelude PrelNames.lhs 
    ghc/compiler/typecheck TcGenDeriv.lhs 
    libraries            Makefile 
    libraries/base       Numeric.hs 
    libraries/base/GHC   Read.lhs 
    libraries/base/Text/ParserCombinators ReadP.hs 
    libraries/base/Text/Read Lex.hs 
  Log:
  	------------------------------------------------
  	Fix the (new) lexer, and make the derived read
  	and show code work according to the new H98 report
  	------------------------------------------------
  
  The new lexer, based on Koen's cunning parser (Text.ParserCombinators.ReadP)
  wasn't quite right.  It's all very cool now.
  
  In particular:
  
  * The H98 "lex" function should return the exact string parsed, and it
  now does, aided by the new combinator ReadP.gather.
  
  * As a result the Text.Read.Lex Lexeme type is much simpler than before
      data Lexeme
        = Char   Char	-- Quotes removed,
        | String String	-- 	escapes interpreted
        | Punc   String 	-- Punctuation, eg "(", "::"
        | Ident  String	-- Haskell identifiers, e.g. foo, baz
        | Symbol String	-- Haskell symbols, e.g. >>, %
        | Int Integer
        | Rat Rational
        | EOF
       deriving (Eq,Show)
  
  * Multi-character punctuation, like "::" was getting lexed as a Symbol,
  but it should be a Punc.
  
  * Parsing numbers wasn't quite right.  "1..n" got it confused because it
  got committed to a decimal point and then found a second '.'.
  
  * The new H98 spec for Show is there, which ignores associativity.
  
  Revision  Changes    Path
  1.55      +1 -1      fptools/ghc/compiler/prelude/PrelNames.lhs
  1.83      +72 -107   fptools/ghc/compiler/typecheck/TcGenDeriv.lhs
  1.8       +3 -2      fptools/libraries/Makefile
  1.11      +5 -4      fptools/libraries/base/Numeric.hs
  1.9       +40 -60    fptools/libraries/base/GHC/Read.lhs
  1.3       +33 -10    fptools/libraries/base/Text/ParserCombinators/ReadP.hs
  1.3       +95 -143   fptools/libraries/base/Text/Read/Lex.hs