haskell / haskell/cabal

Supporting BNFC

Open
#6,726 7 comments 3 reactions 0 assignees View on GitHub
Cabal: other re: build-tool re: preprocessors type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

I'd like to propose that Cabal support BNFC as a build tool. BNFC is a well-known, multi-language parser generator that supports Haskell via Happy & Alex.

**Additional context**
From what I understand, the required changes would be:

- Adding bnfc to this list here: https://github.com/haskell/cabal/blob/0c9792076b30257ff638bf6dd5a13b77ec7b22be/Cabal/Distribution/Simple/BuildToolDepends.hs#L31-L45
- Adding "fc" to "bnfc" here: https://github.com/haskell/cabal/blob/72d67bfe965d0ed700d6879a97cddf7a15ab8ff7/cabal-install/Distribution/Client/Init/Heuristics.hs#L215-L225
- Adding bnfcProgram to this export list: https://github.com/haskell/cabal/blob/9537238f5bd070aac1c998217c3c5e0136e71b4d/Cabal/Distribution/Simple/Program/Builtin.hs#L13 and this list: https://github.com/haskell/cabal/blob/9537238f5bd070aac1c998217c3c5e0136e71b4d/Cabal/Distribution/Simple/Program/Builtin.hs#L69-L70, and introducing a bnfcProgram definition in that module. For bnfc, it appears that just --version is enough to detect the version number.

Questions:
- Would such a patch be accepted?
- If so, would those changes be enough?
- How to handle the need to arguments to bnfc (e.g., `--haskell -p -o `? Would doing this immediately make cabal understand `--with-bnfc`, `--with-bnfc-options` and `bnfc-options:`?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.