You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm working on some projects where we have multiple large Happy parsers, many of which reuse snippets or entire blocks of rules. We'd like to split some rules off into include-able files while staying platform-agnostic (I could easily solve it with some Bash, but then Windows will need its own solution, etc...). Having a Happy feature to allow "sharing" rules between parsers would help in refactoring larger parsers.
I've searched the internet and Happy code/docs and asked #haskell on Libera, but I'm not sure if there's any solution or precedent for this currently.
The text was updated successfully, but these errors were encountered:
@int-index's and my long-term plan is to work on a Template-Haskell variant of happy that, among other benefits, should allow one to compute the grammar that is to be compiled at compile time however one likes. That ought to nail your use-case, but it will probably take a while as there some TH deficiencies to be fixed / worked around.
I would try to use C pre-processor in the meantime :(.
Thanks, great to hear. I wasn't sure if I could use Haskell's CPP extension, since I need to do it at parser generation, and Happy doesn't appear to run CPP (putting preprocessor directives in the rules section quickly gave me a parse error). It's only a maintainability problem, so we'll keep working around it while looking forward to the eventual improvements!
I'm working on some projects where we have multiple large Happy parsers, many of which reuse snippets or entire blocks of rules. We'd like to split some rules off into include-able files while staying platform-agnostic (I could easily solve it with some Bash, but then Windows will need its own solution, etc...). Having a Happy feature to allow "sharing" rules between parsers would help in refactoring larger parsers.
I've searched the internet and Happy code/docs and asked #haskell on Libera, but I'm not sure if there's any solution or precedent for this currently.
The text was updated successfully, but these errors were encountered: