[GHC] #9224: Add support for binary integer literals

GHC ghc-devs at haskell.org
Sat Jun 21 09:44:02 UTC 2014


#9224: Add support for binary integer literals
-------------------------------------------+-------------------------------
       Reporter:  hvr                      |             Owner:
           Type:  feature request          |            Status:  new
       Priority:  normal                   |         Milestone:  7.10.1
      Component:  Compiler (Parser)        |           Version:
       Keywords:  literals                 |  Operating System:
   Architecture:  Unknown/Multiple         |  Unknown/Multiple
     Difficulty:  Easy (less than 1 hour)  |   Type of failure:
     Blocked By:                           |  None/Unknown
Related Tickets:                           |         Test Case:
                                           |          Blocking:
-------------------------------------------+-------------------------------
 Currently, Haskell98/2010 support base-10, base-8 (via `0[oO]`-prefix) and
 base-16 (via `0[xX]`-prefix) integer literals.

 I hereby propose to add conditional support for base-2 integers via a
 `0[bB]`-prefix, controlled via a new `-XBinaryLiterals` language extension
 flag/pragma. The change to the lexer is trivial (see attached patch),
 however I'm stuck on the lexer using a 32-bit feature-mask, of which all
 32bits are already taken, and I'd need a 33th bit for the
 `BinaryLiteralsBit` flag.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9224>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list