haskell / haskell/happy

GLR feature needs to be usable without command line args

Open
#3 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
322
Forks
86
PR merge metrics
No merged PRs in 30d

Description

The GLR feature in Happy is currently not usable for people using cabal (ie everyone) because the GLR feature requires the use of command line arguments, and Cabal provides no way to set happy command line arguments in the .cabal file.

Now you may say "well then, cabal should just let me specify command line arguments to happy". But actually this behaviour in Cabal is by design. The right place to say if your parser is GLR or not is in the .y file itself, not in the .cabal file. In practice each .y file is either going to be GLR or not, and this is something that is decided by the author, not the person building the package.

Exactly how you do this is up to you of course, but happy already has a syntax for directives, like %name, so you could just add something like

```
%grammar glr
```

and similarly for the functionality of the --decode and --filter options.

The general principle here, is to consider that there is a division of roles between the author of the program/package and the person building the package. The person building can decide things like optimisation levels, where input and output files live etc. The author decides the code and anything that is necessary for the meaning of that code. The preferable place to put the code (and related) is in the file itself, or sometimes in the .cabal file, but the less configuration the better. The preferable place for the builder to specify things is in the build environment (cabal command line, cabal config file, sandbox config file etc).

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.