-
Notifications
You must be signed in to change notification settings - Fork 84
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
Happy-generated code fails with Internal Happy error
with -XStrictData
#273
Comments
Just a thought that came to my mind right now: May this be an issue with some low level code failing? I run Happy on a Mac with Apple Silicon ... |
I am assuming you are using the latest release of happy, 1.20.1.1.
On my old-school Mac, your example prints My executable:
source-dirs: .
main: Main
dependencies:
- base
- array
build-tools:
- happy Also just checking: what is your GHC version? |
Thanks for your quick response and pardon the missing informations:
My
Please let me know if there is still information missing. |
As the example works for you, I suppose it is somehow related to my environment. So, I tried the following steps in addition:
|
Thanks for the extra information. This looks good in general, so I do not see an obvious point of attack. Unfortunately, since I cannot produce it locally, I cannot go hunting for the problem myself. |
I followed your advice and tracked down the error by reducing the code in a call-by-name fashion. This was quite an adventure and the outcome is somewhat frustrating. TL;DR: I should have copied my whole So, the story is as follows: Since Happy is a parser generator whose output must be compiled by the user, I think it would be great to mention this somewhere in the documentation (I could at least not find anything related to Anyway, thank you for your help and time! |
Oh, sorry to hear you had a long wild goose chase... It would be nice if we could rewrite happy to make streams explicitly lazy: data HappyStk a = HappyStk a ~(HappyStk a) This is currently not possible without turning on Currently, we would have to turn on Of course, we could use ML-style explicit laziness: data HappyStk a = HappyStk a (() -> HappyStk a) which is a slap in the face of any Haskeller, haha. |
What we could do now is to add |
Internal Happy error
with a minimal exampleInternal Happy error
with -XStrictData
The happy template defines two stream types that never make sense with
So I propose to add {-# LANGUAGE NoStrictData #-} to the template.@int-index @Ericson2314 What do you think? |
Just confirming that I had this same issue and solved it by removing the |
|
I am new to Happy and want to use it for an (old school) introductory course on compiler engineering. Because I repetitively got the very uninformative
Internal Happy error
error, I tested my whole setup with a minimal example. Surprisingly, it still fails withInternal Happy error
.Here is my setup:
After diving a bit into the code I saw that
parse
invokeshappyParse start_state = happyNewToken start_state notHappyAtAll notHappyAtAll
withstart_state = 0#
. It seems like that somewhere deep inside the machinery the secondnotHappyAtAll
is actually evaluated by Haskell, since it is accessed as aHappyStk
here:As far as I understand, this means that Happy fails with an empty stack - probably right before even reading the first token.
Here is some information about my environment:
M3
apple siliconghc --version
prints9.4.8
cabal --version
prints3.10.2.1
happy --version
prints1.20.1.1
My
build.cabal
:I appreciate any kind of help in this situation. This issue is also related to #241.
The text was updated successfully, but these errors were encountered: