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

lexer does not work with GHC 7.8 #26

Closed
luite opened this issue Feb 23, 2014 · 20 comments
Closed

lexer does not work with GHC 7.8 #26

luite opened this issue Feb 23, 2014 · 20 comments

Comments

@luite
Copy link

luite commented Feb 23, 2014

The pregenerated lexer in the 0.5.9 package does not work with GHC 7.8.1rc1. Can you release an update with an updated lexer (from a newer alex)?

cabal install language-javascript gives this result:

[ 6 of 12] Compiling Language.JavaScript.Parser.Lexer ( src/Language/JavaScript/Parser/Lexer.hs, dist/build/Language/JavaScript/Parser/Lexer.o )

src/Language/JavaScript/Parser/Lexer.hs:816:29:
    Couldn't match expected type ‛Bool’ with actual type ‛Int#’
    In the first argument of ‛(&&)’, namely ‛(offset >=# 0#)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s

src/Language/JavaScript/Parser/Lexer.hs:816:48:
    Couldn't match expected type ‛Bool’ with actual type ‛Int#’
    In the second argument of ‛(&&)’, namely ‛(check ==# ord_c)’
    In the expression: (offset >=# 0#) && (check ==# ord_c)
    In the expression:
      if (offset >=# 0#) && (check ==# ord_c) then
          alexIndexInt16OffAddr alex_table offset
      else
          alexIndexInt16OffAddr alex_deflt s
Failed to install language-javascript-0.5.9

while cleaning the package first, forcing it to rebuild the lexer, does install:

$ cabal unpack language-javascript
$ cd language-javascript-0.5.9
$ cabal clean
$ cabal install

It should work if you rebuild the included parser with alex 3.1.3

@alanz
Copy link
Collaborator

alanz commented Feb 23, 2014

@luite

I do not have GHC 7.8 installed, I have just pushed a new version to branch new-alex.

Can you check that it compiles before I release an updated language-javascript?

@geraldus
Copy link

@alanz, I can check if you'll explain me what to do.

@luite
Copy link
Author

luite commented Feb 23, 2014

Oh I might've been wrong about the actual file causing the problem, although re-generating the lexer with the latest alex probably doesn't hurt.

It looks like the actual problem is the Grammar5 file generated by happy, cabal sdist includes it in dist so that happy is not needed as a build tool.

To fix this, install happy 1.19.3 before generating the sdist. To see if your sdist is ok, check dist/build/Language/JavaScript/Parser/Grammar5.hs, check that it has been generated with happy 1.19.3

@alanz
Copy link
Collaborator

alanz commented Feb 23, 2014

I just rebuilt it with happy 1.19.3 (had been using 1.19.2) and GHC 7.6.3,
everything looks ok.

I have not got around to setting up a GHC 7.8 environment yet, so I cannot
test it there. I presume you are building with happy 1.19.3? Still seeing
problems?

Alan

On Sun, Feb 23, 2014 at 5:22 PM, Luite Stegeman notifications@github.comwrote:

Oh I might've been wrong about the actual file causing the problem,
although re-generating the lexer with the latest alex probably doesn't hurt.

It looks like the actual problem is the Grammar5 file generated by happy, cabal
sdist includes it in dist so that happy is not needed as a build tool.

To fix this, install happy 1.19.3 before generating the sdist. To see if
your sdist is ok, check dist/build/Language/JavaScript/Parser/Grammar5.hs,
check that it has been generated with happy 1.19.3

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-35833849
.

@luite
Copy link
Author

luite commented Feb 24, 2014

Yeah it works here with happy 1.19.3, but I can't test it in the git repository since it doesn't contain the Grammar5.hs file. If you build an sdist archive and upload it somewhere i'll test.

@peti
Copy link
Contributor

peti commented Mar 27, 2014

This issue breaks the builds in NixOS as well: http://hydra.cryp.to/build/44774/nixlog/2/raw.

The setup of this package seems really weird. Why is the alex-generated lexer not registered in the Cabal build? It seems really wrong to distribute a generated file -- src/Language/JavaScript/Parser/Lexer.hs -- outside of the dist tree. This is really quite uncommon.

@alanz
Copy link
Collaborator

alanz commented Mar 27, 2014

I was requested to do that because the lexer required a specific version of
alex which is not installed on a target machine where a user just wants to
install language-javascript to satisfy a dependency

See #19

Looking back I see the request originated with you :)

Alan

On Thu, Mar 27, 2014 at 11:17 PM, Peter Simons notifications@github.comwrote:

This issue breaks the builds in NixOS as well:
http://hydra.cryp.to/build/44774/nixlog/2/raw.

The setup of this package seems really weird. Why is the alex-generated
lexer not registered in the Cabal build? It seems really wrong to
distribute a generated file -- src/Language/JavaScript/Parser/Lexer.hs --
outside of the dist tree. This is really quite uncommon.

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-38861864
.

peti added a commit to NixOS/nixpkgs that referenced this issue Mar 27, 2014
@peti
Copy link
Contributor

peti commented Mar 27, 2014

I'm not sure what you mean. Why do you say the request originated with me?

@alanz alanz closed this as completed in 033af3b Mar 30, 2014
@snoyberg
Copy link
Contributor

snoyberg commented Apr 7, 2014

@alanz Would it be possible to release this to Hackage?

@alanz
Copy link
Collaborator

alanz commented Apr 7, 2014

Just to confirm, we are looking at going back to the original way, where
the alex/happy for the current platform are used?

On Mon, Apr 7, 2014 at 8:18 AM, Michael Snoyman notifications@github.comwrote:

@alanz https://github.com/alanz Would it be possible to release this to
Hackage?

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-39699115
.

@snoyberg
Copy link
Contributor

snoyberg commented Apr 7, 2014

I hadn't formed an opinion on that issue tbh. I just was hoping to see a version of language-javascript on Hackage that compiles with GHC 7.8, so that Stackage and Yesod can be built.

@alanz
Copy link
Collaborator

alanz commented Apr 7, 2014

ok, I think it is the same thing. I will sort it out this morning

On Mon, Apr 7, 2014 at 8:23 AM, Michael Snoyman notifications@github.comwrote:

I hadn't formed an opinion on that issue tbh. I just was hoping to see a
version of language-javascript on Hackage that compiles with GHC 7.8, so
that Stackage and Yesod can be built.

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-39699316
.

@alanz
Copy link
Collaborator

alanz commented Apr 7, 2014

Version 0.5.11 is on hackage, it now runs alex as part of the install process, and the builds pass on travis for GHC 7.4, 7.6 and 7.8

@snoyberg
Copy link
Contributor

snoyberg commented Apr 7, 2014

Thanks!

@peti
Copy link
Contributor

peti commented Apr 7, 2014

Unfortunately, the new version does not declare 'alex' as a required BuildTool in its Cabal file. :-(

@alanz
Copy link
Collaborator

alanz commented Apr 7, 2014

Please show me how to do that, I tried before (some time ago) and could not
get it to work

On Mon, Apr 7, 2014 at 12:40 PM, Peter Simons notifications@github.comwrote:

Unfortunately, the new version does not declare 'alex' as a required
BuildTool in its Cabal file. :-(

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-39716117
.

@alanz
Copy link
Collaborator

alanz commented Apr 7, 2014

Version 0.5.12 is on hackage for this

On Mon, Apr 7, 2014 at 12:42 PM, AlanKim Zimmerman alan.zimm@gmail.comwrote:

Please show me how to do that, I tried before (some time ago) and could
not get it to work

On Mon, Apr 7, 2014 at 12:40 PM, Peter Simons notifications@github.comwrote:

Unfortunately, the new version does not declare 'alex' as a required
BuildTool in its Cabal file. :-(

Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-39716117
.

@simonmichael
Copy link
Contributor

With GHC 7.8.2 and alex 3.0.5, the error above still occurs. If you upgrade alex but still have eg happy 1.18.10, you get a new error:

[ 9 of 12] Compiling Language.JavaScript.Parser.Grammar5 ( dist/build/Language/JavaScript/Parser/Grammar5.hs, dist/build/Language/JavaScript/Parser/Grammar5.o )

templates/GenericTemplate.hs:104:22:
    Couldn't match expected type `Bool'
                with actual type `Happy_GHC_Exts.Int#'
    In the expression:
      (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
    In a stmt of a pattern guard for
                   a case alternative:
      (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
    In a case alternative:
        n | (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
          -> (happyReduceArr Happy_Data_Array.! rule) i tk st
          where
              rule
                = (Happy_GHC_Exts.I#
                     ((Happy_GHC_Exts.negateInt#
                         ((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))

etc.

With alex 3.1.3 and happy 1.19.3, it worked for me. The package should specify the required newer versions.

@alanz
Copy link
Collaborator

alanz commented Apr 17, 2014

Ok, I will only be able to get to this tomorrow some time

On Thu, Apr 17, 2014 at 4:41 PM, Simon Michael notifications@github.comwrote:

With GHC 7.8.2 and alex 3.0.5, the error above still occurs. If you
upgrade alex but still have eg happy 1.18.10, you get a new error:

[ 9 of 12] Compiling Language.JavaScript.Parser.Grammar5 ( dist/build/Language/JavaScript/Parser/Grammar5.hs, dist/build/Language/JavaScript/Parser/Grammar5.o )

templates/GenericTemplate.hs:104:22:
Couldn't match expected type Bool' with actual typeHappy_GHC_Exts.Int#'
In the expression:
(n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
In a stmt of a pattern guard for
a case alternative:
(n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
In a case alternative:
n | (n Happy_GHC_Exts.<# (0# :: Happy_GHC_Exts.Int#))
-> (happyReduceArr Happy_Data_Array.! rule) i tk st
where
rule
= (Happy_GHC_Exts.I#
((Happy_GHC_Exts.negateInt#
((n Happy_GHC_Exts.+# (1# :: Happy_GHC_Exts.Int#))))))

etc.

With alex 3.1.3 and happy 1.19.3, it worked for me. The package should
specify the required newer versions.


Reply to this email directly or view it on GitHubhttps://github.com//issues/26#issuecomment-40721311
.

@bergmark
Copy link

I just ran into this too, upgrading alex and happy solved it.

erikd pushed a commit that referenced this issue Jul 29, 2015
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

7 participants