Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange AST Produced with certain extensions and Numeric literals #455

Open
merc1031 opened this issue Jun 27, 2020 · 0 comments
Open

Strange AST Produced with certain extensions and Numeric literals #455

merc1031 opened this issue Jun 27, 2020 · 0 comments

Comments

@merc1031
Copy link

There are a few issues with extended numeric literals i have seen when poking around floskell Which uses HSE
Ill try to capture these below

HexFloatLiterals produce a series of InifixApp and QVarOp, which ends up being ambiguous
They both produce the following (cleaned up for visibility)
Both f 0xF . FFp12 and f 0xF.FFp12 (with -XHexFloatLiterals, ghci and ghc turn this one into a Float)
produce

InfixApp
  ( App
      ( Var
          ( UnQual
              ( Ident
                 "f"
              )
          )
      )
      ( Lit
          ( Int
              15 "0xF"
          )
      )
  )
  ( QVarOp
      ( UnQual
          ( Symbol
              "."
          )
      )
  )
  ( Con
      ( UnQual
          ( Ident
             "FFp12"
          )
      )
  )

NumericUnderscores produce 2 different issues.
The first, simpler issue:
It splits the int on the first _ and produces an App
3_000
produces

( App
    ( Lit
        ( Int
            3 "3"
        )
    )
    ( Var
        ( UnQual
            ( Ident
                "_000"
            )
        )
    )
)

The second more broken issue is combined with exponent syntax:
It splits the int on the first _ and produces an App followed by a QVarOp +
6.022_140_857e+23
produces

InfixApp
    ( App
        ( Lit
            ( Frac
                ( 3011 % 500 ) "6.022"
            )
        )
        ( Var
            ( UnQual
                ( Ident
                    "_140_857e"
                )
            )
        )
    )
    ( QVarOp
        ( UnQual
            ( Symbol
                "+"
            )
        )
    )
    ( Lit
        ( Int
            23 "23"
        )
    )
)
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
merc1031 pushed a commit to merc1031/haskell-src-exts that referenced this issue Jun 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant