augustss / MicroCabal

Reimplementation of a subset of Cabal
Apache License 2.0
10 stars 1 forks source link

Compatibility goals? #2

Open ysangkok opened 4 weeks ago

ysangkok commented 4 weeks ago

This looks like a very interesting project, but I am wondering what the goal is, is this supposed to be compatible with a large fraction of packages on Hackage? Or is that simply not a goal?

For example, parsec-2.1.0.1 has tabs and carriage return in its cabal file. I was able to adjust the parser to accept that. But it also uses braces, which I hadn't seen before. And now I don't know whether it makes sense to start to have MicroCabal parse this.

Since I suspect that the code will be more minimal if unnecessary features are avoided, it's a trade-off: Either the code is uglier and more compatible, or it is prettier and less compatible. To align contributors to the project goals, it would make sense to specify the goals in the readme file.

augustss commented 4 weeks ago

I think it makes sense for the parser to be compatible. It's hard to do without trial-and-error since there is no documented grammar. I'm happy to take any fixes you make.

augustss commented 3 weeks ago

The goal is to be able to build all packages from Hackage. It's far from there.

ysangkok commented 2 weeks ago

The goal is to be able to build all packages from Hackage.

That's good to hear.

there is no documented grammar.

There is this, but it doesn't seem to cover indention (possibly because it is context-sensitive then?) comment in Fields/Parser.hs.

There is a paper with a modification of Happy that provides an academic underpinning of indention: Principled Parsing for Indention-Sensitive Languages. Thanks to @TeofilC for making me aware of this.

augustss commented 2 weeks ago

My parser can deal with Haskell style indentation, so it should be adaptable to Cabal too. I had not noticed the comment in the field parser. I wonder how accurate it is?