29

I have googled extensively, and while I can find many examples of cabal files as well as good tutorials, I would like to have a proper grammar definition for the .cabal file format. Alas, I have not been able to find it. The more recent cabal documentation only mentions that its file format is backwards compatible -- with no links to the 'original' format with which it is compatible! Not useful.

Jacques Carette
  • 3,052
  • 1
  • 22
  • 28

3 Answers3

15

a proper grammar definition for the .cabal file format.

The grammar is defined by its parser. I don't know of a formal specification.

Benjamin Barenblat
  • 1,311
  • 6
  • 19
Don Stewart
  • 137,316
  • 36
  • 365
  • 468
  • 4
    It certainly is *an* answer. I may even be forced to accept it as 'the' answer. Unfortunate. – Jacques Carette Jun 18 '12 at 20:38
  • 2
    If a formal grammar existed there is no reason the developers would not have included it along with the sources, hence the parser is very likely the closest thing to a grammar that you will find. – Laurent Giroud Jun 26 '14 at 05:28
4

Is this what you want?

Distribution.PackageDiscription

rem
  • 893
  • 4
  • 18
1

The list of the fields, whether they are required or not, and what goes in them is here https://www.haskell.org/cabal/users-guide/developing-packages.html#package-properties.

Not the most obvious of places, I must admit.

Marcelo Lazaroni
  • 9,819
  • 3
  • 35
  • 41