-
Notifications
You must be signed in to change notification settings - Fork 696
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
Field Syntax Reference bugs #9793
Comments
Thank you! As I mentioned in the discussion, it would be much better if we generated parts of this from the code directly, otherwise it will always tend to get out of sync and be incomplete. Some small notes: I believe for the precise field syntax of cabal-version 3.4, then indeed 3.4 is the only allowable value for cabal-version. But that's not the right way to document it, lol. on x-revision we should document in general an x-convention where such fields are disregarded by cabal. In general I bet a lot of our comma lists should be optional comma lists. and finally we don't have a section for the executable stanza at all. |
I think it should be the other way around. Cabal file format should have a specification, not defined by the implementation. Otherwise, it becomes really difficult to implement a third party cabal file parser, as the author needs to understand the Cabal-syntax package, instead of an abstract specification. |
Yes!!! There should be a grammar for Cabal file format. This should be the specification. If it can be used to produce parsers, all the better. I find the current field syntax specification vexing. E.g., who uses explicit fixpoints to describe a grammar? Also, defining fields as "monoidal" is ok, but unless you know what monoid it is, it doesn't really say much. All in all, writing a parser for the Cabal file format has been a lot of guess work and testing. |
I've seen other values, and they seem to be accepted. Also, my Cabal is version 3.10.2.1, so "3.4" seems quite wrong. |
Cabal file format version and Cabal version are two completely distinct values, in theory. It is not wrong, but quite confusing indeed, due to our insistence on naming collisions :) |
What I mean is we should be able to take the current implementation (and every prior version using the same parser format) and automatically derive a standard specification from them, programmatically. We could then choose to evolve "spec first" or "implementation first" but the end result would be that we always have a proper spec that can be understood independently of the implementation, and that it is in sync with what the implementation actually does. |
The flag stanza is also not in section 10. |
I asked ChatGPT about a BNF grammar for Cabal files. It did surprisingly well. Better than the Cabal documentation. 😀 |
In section 10, Field Syntax Reference there are many bugs.
Here are some I found today:
In the description of \ring and \bullet it's unclear what "spaces" means.
Is it a 0x20 character? Or can it also be a 0x0a? It seems to be the latter.
I will report more as I find them. This was from parsing a single .cabal file with my parser that follows section 10.
The text was updated successfully, but these errors were encountered: