-
Notifications
You must be signed in to change notification settings - Fork 164
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
Cabal support for bnfc #7
Comments
I've done that for the |
Yes, one could modify Lines 1 to 6 in fb85ff1
However, I don't see the point really. It seems better to have the BNFC-generated LBNF parser committed to the repo and included in the sdist tarball to avoid boot-strapping issues. |
However, I don't see the point really. It seems better to have the
BNFC-generated LBNF parser committed to the repo and included in the
sdist tarball to avoid boot-strapping issues.
The point is that Cabal will do that for you automatically, i.e. it will
generate the source code and include it in the generater sdist tarball.
Checking generating source code into the git repository, however, is a
really bad idea because people will forget to update those files. This
will happen a couple of times, and then you'll decide that you'll need
some automatism to ensure the generated files up-to-date. That
automatism is Cabal.
|
@peti, I agree that it would be nicer if Cabal would know about the BNFC-generated files. I did some research but did not find out how to teach Cabal about BNFC. Cabal seems to have a set of hardwired build-tools it knows about, like happy, alex etc., but there is no plugin mechanism I know of that would allow me to integrate BNFC. I would have to add it to the Cabal sources, it seems. Am I right? @fgaz : Maybe you have some information about the build-tool handling in Cabal? (Besides the technical difficulties, there is a bit of concern about backwards compatibility of BNFC. Later versions of BNFC might change the interface the generated files expose, so that code relying on a certain interface would not work with file generated by a newer BNFC. Of course, if one is worried about that, one can always commit the BNFC generated files to the source tree and not invoke BNFC in the build process.) |
Yes. Either that, or a custom setup has to be used The relevant module is
If correct version bounds are used on |
Or CI :) Another nice way of treating generated files, IMO, is to only include them in release tarballs. This way:
It's not necessarily bad to wrap cabal, or to have some preprocessing steps for development/distribution, especially if this avoids a custom Setup. Cabal itself does this (though for BC reasons). |
So a first step could be to have the Haskell backend of BNFC generate a @fgaz: Since I have you here, do you know how the hardwiring of e.g. P.S.: There is PR #173 to create a cabal file. Maybe this can be extended to also create the |
As far as I know there's no way to pass options to preprocessors. One way of working around that could be to accept options in the .cf file itself, like GHC language pragmas. |
I just had a chat in #hackage on freenode and no, they would not. On the other hand, they're open to the possibility of adding extensible preprocessing in Cabal |
See also this discussion on adding BNFC support to cabal: haskell/cabal#6726 |
@peti wrote:
If you use a front-end to version control like |
Add support in cabal to build bnf files using bnfc (like what is done with alex and happy). This would, among other things, make bnfc own compilation easier.
The text was updated successfully, but these errors were encountered: