From 86b4f0f2a7efd622db56268eeb0807549a74c70d Mon Sep 17 00:00:00 2001 From: Sebastian Graf Date: Fri, 13 Sep 2024 09:16:00 +0200 Subject: [PATCH] New package `happy-lib`; make previous `happy-*` packages sublibraries (#288) This is one design design discussed in #288. Fixes #288. --- .github/workflows/haskell-ci.yml | 50 +----- {src => app}/Main.lhs | 0 cabal.project | 4 +- happy.cabal | 13 +- lib/ChangeLog.md | 1 + lib/README.md | 1 + {packages => lib}/backend-glr/LICENSE | 0 {packages => lib}/backend-glr/Setup.hs | 0 .../backend-glr/src/Happy/Backend/GLR.hs | 4 +- .../src/Happy/Backend/GLR/ProduceCode.lhs | 2 +- {packages => lib}/backend-lalr/LICENSE | 0 {packages => lib}/backend-lalr/Setup.hs | 0 .../backend-lalr/src/Happy/Backend/LALR.hs | 2 +- .../src/Happy/Backend/LALR/ProduceCode.lhs | 2 +- .../backend-glr => lib}/data/GLR_Base.hs | 0 {packages/backend-glr => lib}/data/GLR_Lib.hs | 0 .../data/HappyTemplate.hs | 0 {packages => lib}/frontend/LICENSE | 0 {packages => lib}/frontend/Setup.hs | 0 .../frontend/boot-src/AttrGrammarParser.ly | 0 {packages => lib}/frontend/boot-src/Parser.ly | 0 {packages => lib}/frontend/bootstrap.sh | 0 .../frontend/src/Happy/Frontend.hs | 0 .../frontend/src/Happy/Frontend/AbsSyn.lhs | 0 .../src/Happy/Frontend/AttrGrammar.lhs | 0 .../Happy/Frontend/AttrGrammar/Mangler.lhs | 0 .../src/Happy/Frontend/AttrGrammar/Parser.hs | 0 .../frontend/src/Happy/Frontend/Lexer.lhs | 0 .../frontend/src/Happy/Frontend/Mangler.lhs | 0 .../src/Happy/Frontend/Mangler/Monad.lhs | 0 .../frontend/src/Happy/Frontend/ParamRules.hs | 0 .../frontend/src/Happy/Frontend/ParseMonad.hs | 0 .../src/Happy/Frontend/ParseMonad/Class.hs | 0 .../frontend/src/Happy/Frontend/Parser.hs | 0 .../src/Happy/Frontend/PrettyGrammar.hs | 0 {packages => lib}/grammar/LICENSE | 0 {packages => lib}/grammar/Setup.hs | 0 .../grammar/src/Happy/Grammar.lhs | 0 lib/happy-lib.cabal | 168 ++++++++++++++++++ {packages => lib}/tabular/LICENSE | 0 {packages => lib}/tabular/Setup.hs | 0 .../tabular/src/Happy/Tabular.lhs | 0 .../tabular/src/Happy/Tabular/First.lhs | 0 .../tabular/src/Happy/Tabular/Info.lhs | 0 .../tabular/src/Happy/Tabular/LALR.lhs | 0 .../tabular/src/Happy/Tabular/NameSet.hs | 0 packages/backend-glr/happy-backend-glr.cabal | 60 ------- .../backend-lalr/happy-backend-lalr.cabal | 59 ------ packages/frontend/happy-frontend.cabal | 68 ------- packages/grammar/happy-grammar.cabal | 50 ------ packages/tabular/happy-tabular.cabal | 56 ------ 51 files changed, 188 insertions(+), 352 deletions(-) rename {src => app}/Main.lhs (100%) create mode 120000 lib/ChangeLog.md create mode 120000 lib/README.md rename {packages => lib}/backend-glr/LICENSE (100%) rename {packages => lib}/backend-glr/Setup.hs (100%) rename {packages => lib}/backend-glr/src/Happy/Backend/GLR.hs (51%) rename {packages => lib}/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs (99%) rename {packages => lib}/backend-lalr/LICENSE (100%) rename {packages => lib}/backend-lalr/Setup.hs (100%) rename {packages => lib}/backend-lalr/src/Happy/Backend/LALR.hs (98%) rename {packages => lib}/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs (99%) rename {packages/backend-glr => lib}/data/GLR_Base.hs (100%) rename {packages/backend-glr => lib}/data/GLR_Lib.hs (100%) rename {packages/backend-lalr => lib}/data/HappyTemplate.hs (100%) rename {packages => lib}/frontend/LICENSE (100%) rename {packages => lib}/frontend/Setup.hs (100%) rename {packages => lib}/frontend/boot-src/AttrGrammarParser.ly (100%) rename {packages => lib}/frontend/boot-src/Parser.ly (100%) rename {packages => lib}/frontend/bootstrap.sh (100%) rename {packages => lib}/frontend/src/Happy/Frontend.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/AbsSyn.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/AttrGrammar.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/AttrGrammar/Mangler.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/AttrGrammar/Parser.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/Lexer.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/Mangler.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/Mangler/Monad.lhs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/ParamRules.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/ParseMonad.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/ParseMonad/Class.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/Parser.hs (100%) rename {packages => lib}/frontend/src/Happy/Frontend/PrettyGrammar.hs (100%) rename {packages => lib}/grammar/LICENSE (100%) rename {packages => lib}/grammar/Setup.hs (100%) rename {packages => lib}/grammar/src/Happy/Grammar.lhs (100%) create mode 100644 lib/happy-lib.cabal rename {packages => lib}/tabular/LICENSE (100%) rename {packages => lib}/tabular/Setup.hs (100%) rename {packages => lib}/tabular/src/Happy/Tabular.lhs (100%) rename {packages => lib}/tabular/src/Happy/Tabular/First.lhs (100%) rename {packages => lib}/tabular/src/Happy/Tabular/Info.lhs (100%) rename {packages => lib}/tabular/src/Happy/Tabular/LALR.lhs (100%) rename {packages => lib}/tabular/src/Happy/Tabular/NameSet.hs (100%) delete mode 100644 packages/backend-glr/happy-backend-glr.cabal delete mode 100644 packages/backend-lalr/happy-backend-lalr.cabal delete mode 100644 packages/frontend/happy-frontend.cabal delete mode 100644 packages/grammar/happy-grammar.cabal delete mode 100644 packages/tabular/happy-tabular.cabal diff --git a/.github/workflows/haskell-ci.yml b/.github/workflows/haskell-ci.yml index 07b7c7cd..e8ecc639 100644 --- a/.github/workflows/haskell-ci.yml +++ b/.github/workflows/haskell-ci.yml @@ -179,12 +179,8 @@ jobs: - name: initial cabal.project for sdist run: | touch cabal.project - echo "packages: $GITHUB_WORKSPACE/source/packages/tabular" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/packages/frontend" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/packages/backend-lalr" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/packages/backend-glr" >> cabal.project - echo "packages: $GITHUB_WORKSPACE/source/packages/grammar" >> cabal.project echo "packages: $GITHUB_WORKSPACE/source/." >> cabal.project + echo "packages: $GITHUB_WORKSPACE/source/lib" >> cabal.project cat cabal.project - name: sdist run: | @@ -196,42 +192,22 @@ jobs: find sdist -maxdepth 1 -type f -name '*.tar.gz' -exec tar -C $GITHUB_WORKSPACE/unpacked -xzvf {} \; - name: generate cabal.project run: | - PKGDIR_happy_tabular="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-tabular-[0-9.]*')" - echo "PKGDIR_happy_tabular=${PKGDIR_happy_tabular}" >> "$GITHUB_ENV" - PKGDIR_happy_frontend="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-frontend-[0-9.]*')" - echo "PKGDIR_happy_frontend=${PKGDIR_happy_frontend}" >> "$GITHUB_ENV" - PKGDIR_happy_backend_lalr="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-backend-lalr-[0-9.]*')" - echo "PKGDIR_happy_backend_lalr=${PKGDIR_happy_backend_lalr}" >> "$GITHUB_ENV" - PKGDIR_happy_backend_glr="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-backend-glr-[0-9.]*')" - echo "PKGDIR_happy_backend_glr=${PKGDIR_happy_backend_glr}" >> "$GITHUB_ENV" - PKGDIR_happy_grammar="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-grammar-[0-9.]*')" - echo "PKGDIR_happy_grammar=${PKGDIR_happy_grammar}" >> "$GITHUB_ENV" PKGDIR_happy="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-[0-9.]*')" echo "PKGDIR_happy=${PKGDIR_happy}" >> "$GITHUB_ENV" + PKGDIR_happy_lib="$(find "$GITHUB_WORKSPACE/unpacked" -maxdepth 1 -type d -regex '.*/happy-lib-[0-9.]*')" + echo "PKGDIR_happy_lib=${PKGDIR_happy_lib}" >> "$GITHUB_ENV" rm -f cabal.project cabal.project.local touch cabal.project touch cabal.project.local - echo "packages: ${PKGDIR_happy_tabular}" >> cabal.project - echo "packages: ${PKGDIR_happy_frontend}" >> cabal.project - echo "packages: ${PKGDIR_happy_backend_lalr}" >> cabal.project - echo "packages: ${PKGDIR_happy_backend_glr}" >> cabal.project - echo "packages: ${PKGDIR_happy_grammar}" >> cabal.project echo "packages: ${PKGDIR_happy}" >> cabal.project - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-tabular" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-frontend" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-backend-lalr" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-backend-glr" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-grammar" >> cabal.project ; fi - if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + echo "packages: ${PKGDIR_happy_lib}" >> cabal.project if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy" >> cabal.project ; fi if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package happy-lib" >> cabal.project ; fi + if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi cat >> cabal.project <> cabal.project.local + $HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(containers|happy|happy-lib|mtl|transformers)$/; }' >> cabal.project.local cat cabal.project cat cabal.project.local - name: dump install plan @@ -259,18 +235,10 @@ jobs: $CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct - name: cabal check run: | - cd ${PKGDIR_happy_tabular} || false - ${CABAL} -vnormal check - cd ${PKGDIR_happy_frontend} || false - ${CABAL} -vnormal check - cd ${PKGDIR_happy_backend_lalr} || false - ${CABAL} -vnormal check - cd ${PKGDIR_happy_backend_glr} || false - ${CABAL} -vnormal check - cd ${PKGDIR_happy_grammar} || false - ${CABAL} -vnormal check cd ${PKGDIR_happy} || false ${CABAL} -vnormal check + cd ${PKGDIR_happy_lib} || false + ${CABAL} -vnormal check - name: haddock run: | $CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all diff --git a/src/Main.lhs b/app/Main.lhs similarity index 100% rename from src/Main.lhs rename to app/Main.lhs diff --git a/cabal.project b/cabal.project index 1f3ee959..2cc68d7c 100644 --- a/cabal.project +++ b/cabal.project @@ -1,3 +1,3 @@ packages: - packages/*/happy-*.cabal - ./ + happy.cabal + lib/happy-lib.cabal diff --git a/happy.cabal b/happy.cabal index b4cb264b..c91f55fb 100644 --- a/happy.cabal +++ b/happy.cabal @@ -31,11 +31,6 @@ tested-with: GHC == 8.4.4 GHC == 8.2.2 GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 extra-source-files: ChangeLog.md @@ -137,18 +132,14 @@ source-repository head location: https://github.com/haskell/happy.git executable happy - hs-source-dirs: src + hs-source-dirs: app main-is: Main.lhs build-depends: base >= 4.9 && < 5, array, containers >= 0.4.2, mtl >= 2.2.1, - happy-grammar == 2.0, - happy-tabular == 2.0, - happy-frontend == 2.0, - happy-backend-lalr == 2.0, - happy-backend-glr == 2.0 + happy-lib == 2.0 default-language: Haskell98 default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns diff --git a/lib/ChangeLog.md b/lib/ChangeLog.md new file mode 120000 index 00000000..41c10a61 --- /dev/null +++ b/lib/ChangeLog.md @@ -0,0 +1 @@ +../ChangeLog.md \ No newline at end of file diff --git a/lib/README.md b/lib/README.md new file mode 120000 index 00000000..32d46ee8 --- /dev/null +++ b/lib/README.md @@ -0,0 +1 @@ +../README.md \ No newline at end of file diff --git a/packages/backend-glr/LICENSE b/lib/backend-glr/LICENSE similarity index 100% rename from packages/backend-glr/LICENSE rename to lib/backend-glr/LICENSE diff --git a/packages/backend-glr/Setup.hs b/lib/backend-glr/Setup.hs similarity index 100% rename from packages/backend-glr/Setup.hs rename to lib/backend-glr/Setup.hs diff --git a/packages/backend-glr/src/Happy/Backend/GLR.hs b/lib/backend-glr/src/Happy/Backend/GLR.hs similarity index 51% rename from packages/backend-glr/src/Happy/Backend/GLR.hs rename to lib/backend-glr/src/Happy/Backend/GLR.hs index e11351ce..fd896c5b 100644 --- a/packages/backend-glr/src/Happy/Backend/GLR.hs +++ b/lib/backend-glr/src/Happy/Backend/GLR.hs @@ -1,6 +1,6 @@ module Happy.Backend.GLR where -import Paths_happy_backend_glr +import Paths_happy_lib glrBackendDataDir :: IO String -glrBackendDataDir = getDataDir \ No newline at end of file +glrBackendDataDir = getDataDir diff --git a/packages/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs b/lib/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs similarity index 99% rename from packages/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs rename to lib/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs index 9cef6e49..f10a2bc7 100644 --- a/packages/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs +++ b/lib/backend-glr/src/Happy/Backend/GLR/ProduceCode.lhs @@ -17,7 +17,7 @@ This module is designed as an extension to the Haskell parser generator Happy. > , Options > ) where -> import Paths_happy_backend_glr ( version ) +> import Paths_happy_lib ( version ) > import Happy.Grammar > import Happy.Tabular.LALR > import Data.Array ( Array, (!), array, assocs ) diff --git a/packages/backend-lalr/LICENSE b/lib/backend-lalr/LICENSE similarity index 100% rename from packages/backend-lalr/LICENSE rename to lib/backend-lalr/LICENSE diff --git a/packages/backend-lalr/Setup.hs b/lib/backend-lalr/Setup.hs similarity index 100% rename from packages/backend-lalr/Setup.hs rename to lib/backend-lalr/Setup.hs diff --git a/packages/backend-lalr/src/Happy/Backend/LALR.hs b/lib/backend-lalr/src/Happy/Backend/LALR.hs similarity index 98% rename from packages/backend-lalr/src/Happy/Backend/LALR.hs rename to lib/backend-lalr/src/Happy/Backend/LALR.hs index 2e234202..ca144464 100644 --- a/packages/backend-lalr/src/Happy/Backend/LALR.hs +++ b/lib/backend-lalr/src/Happy/Backend/LALR.hs @@ -1,6 +1,6 @@ module Happy.Backend.LALR where -import Paths_happy_backend_lalr +import Paths_happy_lib import Data.Char lalrBackendDataDir :: IO String diff --git a/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs b/lib/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs similarity index 99% rename from packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs rename to lib/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs index 942f2382..e2fbe890 100644 --- a/packages/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs +++ b/lib/backend-lalr/src/Happy/Backend/LALR/ProduceCode.lhs @@ -6,7 +6,7 @@ The code generator. > module Happy.Backend.LALR.ProduceCode (produceParser) where -> import Paths_happy_backend_lalr ( version ) +> import Paths_happy_lib ( version ) > import Data.Version ( showVersion ) > import Happy.Grammar > import Happy.Tabular.LALR diff --git a/packages/backend-glr/data/GLR_Base.hs b/lib/data/GLR_Base.hs similarity index 100% rename from packages/backend-glr/data/GLR_Base.hs rename to lib/data/GLR_Base.hs diff --git a/packages/backend-glr/data/GLR_Lib.hs b/lib/data/GLR_Lib.hs similarity index 100% rename from packages/backend-glr/data/GLR_Lib.hs rename to lib/data/GLR_Lib.hs diff --git a/packages/backend-lalr/data/HappyTemplate.hs b/lib/data/HappyTemplate.hs similarity index 100% rename from packages/backend-lalr/data/HappyTemplate.hs rename to lib/data/HappyTemplate.hs diff --git a/packages/frontend/LICENSE b/lib/frontend/LICENSE similarity index 100% rename from packages/frontend/LICENSE rename to lib/frontend/LICENSE diff --git a/packages/frontend/Setup.hs b/lib/frontend/Setup.hs similarity index 100% rename from packages/frontend/Setup.hs rename to lib/frontend/Setup.hs diff --git a/packages/frontend/boot-src/AttrGrammarParser.ly b/lib/frontend/boot-src/AttrGrammarParser.ly similarity index 100% rename from packages/frontend/boot-src/AttrGrammarParser.ly rename to lib/frontend/boot-src/AttrGrammarParser.ly diff --git a/packages/frontend/boot-src/Parser.ly b/lib/frontend/boot-src/Parser.ly similarity index 100% rename from packages/frontend/boot-src/Parser.ly rename to lib/frontend/boot-src/Parser.ly diff --git a/packages/frontend/bootstrap.sh b/lib/frontend/bootstrap.sh similarity index 100% rename from packages/frontend/bootstrap.sh rename to lib/frontend/bootstrap.sh diff --git a/packages/frontend/src/Happy/Frontend.hs b/lib/frontend/src/Happy/Frontend.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend.hs rename to lib/frontend/src/Happy/Frontend.hs diff --git a/packages/frontend/src/Happy/Frontend/AbsSyn.lhs b/lib/frontend/src/Happy/Frontend/AbsSyn.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/AbsSyn.lhs rename to lib/frontend/src/Happy/Frontend/AbsSyn.lhs diff --git a/packages/frontend/src/Happy/Frontend/AttrGrammar.lhs b/lib/frontend/src/Happy/Frontend/AttrGrammar.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/AttrGrammar.lhs rename to lib/frontend/src/Happy/Frontend/AttrGrammar.lhs diff --git a/packages/frontend/src/Happy/Frontend/AttrGrammar/Mangler.lhs b/lib/frontend/src/Happy/Frontend/AttrGrammar/Mangler.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/AttrGrammar/Mangler.lhs rename to lib/frontend/src/Happy/Frontend/AttrGrammar/Mangler.lhs diff --git a/packages/frontend/src/Happy/Frontend/AttrGrammar/Parser.hs b/lib/frontend/src/Happy/Frontend/AttrGrammar/Parser.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/AttrGrammar/Parser.hs rename to lib/frontend/src/Happy/Frontend/AttrGrammar/Parser.hs diff --git a/packages/frontend/src/Happy/Frontend/Lexer.lhs b/lib/frontend/src/Happy/Frontend/Lexer.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/Lexer.lhs rename to lib/frontend/src/Happy/Frontend/Lexer.lhs diff --git a/packages/frontend/src/Happy/Frontend/Mangler.lhs b/lib/frontend/src/Happy/Frontend/Mangler.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/Mangler.lhs rename to lib/frontend/src/Happy/Frontend/Mangler.lhs diff --git a/packages/frontend/src/Happy/Frontend/Mangler/Monad.lhs b/lib/frontend/src/Happy/Frontend/Mangler/Monad.lhs similarity index 100% rename from packages/frontend/src/Happy/Frontend/Mangler/Monad.lhs rename to lib/frontend/src/Happy/Frontend/Mangler/Monad.lhs diff --git a/packages/frontend/src/Happy/Frontend/ParamRules.hs b/lib/frontend/src/Happy/Frontend/ParamRules.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/ParamRules.hs rename to lib/frontend/src/Happy/Frontend/ParamRules.hs diff --git a/packages/frontend/src/Happy/Frontend/ParseMonad.hs b/lib/frontend/src/Happy/Frontend/ParseMonad.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/ParseMonad.hs rename to lib/frontend/src/Happy/Frontend/ParseMonad.hs diff --git a/packages/frontend/src/Happy/Frontend/ParseMonad/Class.hs b/lib/frontend/src/Happy/Frontend/ParseMonad/Class.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/ParseMonad/Class.hs rename to lib/frontend/src/Happy/Frontend/ParseMonad/Class.hs diff --git a/packages/frontend/src/Happy/Frontend/Parser.hs b/lib/frontend/src/Happy/Frontend/Parser.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/Parser.hs rename to lib/frontend/src/Happy/Frontend/Parser.hs diff --git a/packages/frontend/src/Happy/Frontend/PrettyGrammar.hs b/lib/frontend/src/Happy/Frontend/PrettyGrammar.hs similarity index 100% rename from packages/frontend/src/Happy/Frontend/PrettyGrammar.hs rename to lib/frontend/src/Happy/Frontend/PrettyGrammar.hs diff --git a/packages/grammar/LICENSE b/lib/grammar/LICENSE similarity index 100% rename from packages/grammar/LICENSE rename to lib/grammar/LICENSE diff --git a/packages/grammar/Setup.hs b/lib/grammar/Setup.hs similarity index 100% rename from packages/grammar/Setup.hs rename to lib/grammar/Setup.hs diff --git a/packages/grammar/src/Happy/Grammar.lhs b/lib/grammar/src/Happy/Grammar.lhs similarity index 100% rename from packages/grammar/src/Happy/Grammar.lhs rename to lib/grammar/src/Happy/Grammar.lhs diff --git a/lib/happy-lib.cabal b/lib/happy-lib.cabal new file mode 100644 index 00000000..1f00f10c --- /dev/null +++ b/lib/happy-lib.cabal @@ -0,0 +1,168 @@ +cabal-version: 3.0 +name: happy-lib +version: 2.0 +license: BSD-2-Clause +copyright: (c) Andy Gill, Simon Marlow +author: Andy Gill and Simon Marlow +maintainer: https://github.com/haskell/happy +bug-reports: https://github.com/haskell/happy/issues +stability: stable +homepage: https://www.haskell.org/happy/ +synopsis: Happy is a parser generator for Haskell implemented using this library +category: Development +build-type: Simple + +Description: + Happy is a parser generator for Haskell. Given a grammar + specification in BNF, Happy generates Haskell code to parse the + grammar. Happy works in a similar way to the @yacc@ tool for C. + + This library provides the following functionality: + + * Data type definitions for the Grammar AST type, capturing the information in .y-files (Happy.Grammar) + + * A parser for happy grammar files (.y) to produce a Grammar (Happy.Frontend.*) + + * Implementations of the text book algorithms that compute the LR action and + goto tables for the given 'Grammar' (Happy.Tabular.*) + + * An LALR code generator to produce table-driven, deterministic parsing code + in Haskell (Happy.Backend.LALR.*) + + * A (less maintained) GLR code generator to produce table-driven, + non-deterministic parsing code in Haskell, where ambiguous parses produce + multiple parse trees (Happy.Backend.GLR.*) + +tested-with: + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.5 + GHC == 9.4.8 + GHC == 9.2.8 + GHC == 9.0.2 + GHC == 8.10.7 + GHC == 8.8.4 + GHC == 8.6.5 + GHC == 8.4.4 + GHC == 8.2.2 + GHC == 8.0.2 + +extra-source-files: + ChangeLog.md + README.md + frontend/bootstrap.sh + frontend/boot-src/Parser.ly + frontend/boot-src/AttrGrammarParser.ly + +data-dir: data + +data-files: + HappyTemplate.hs + GLR_Base.hs + GLR_Lib.hs + +source-repository head + type: git + location: https://github.com/haskell/happy.git + +library grammar + hs-source-dirs: grammar/src + + exposed-modules: Happy.Grammar + build-depends: base < 5, array + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts + ghc-options: -Wall + other-modules: + +library frontend + hs-source-dirs: frontend/src + exposed-modules: Happy.Frontend, + Happy.Frontend.AbsSyn, + Happy.Frontend.Mangler, + Happy.Frontend.PrettyGrammar + + build-depends: base < 5, array, transformers, containers, mtl, happy-lib:grammar + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts + ghc-options: -Wall -Wno-incomplete-uni-patterns + other-modules: + Happy.Frontend.ParseMonad + Happy.Frontend.ParseMonad.Class + Happy.Frontend.Mangler.Monad + Happy.Frontend.Parser + Happy.Frontend.Lexer + Happy.Frontend.ParamRules + Happy.Frontend.AttrGrammar + Happy.Frontend.AttrGrammar.Parser + Happy.Frontend.AttrGrammar.Mangler + +library tabular + hs-source-dirs: tabular/src + + exposed-modules: Happy.Tabular, + Happy.Tabular.First, + Happy.Tabular.Info, + Happy.Tabular.LALR, + Happy.Tabular.NameSet + build-depends: base < 5, array, containers, happy-lib:grammar + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns + ghc-options: -Wall + +library backend-lalr + hs-source-dirs: backend-lalr/src + + exposed-modules: Happy.Backend.LALR, + Happy.Backend.LALR.ProduceCode + build-depends: base < 5, array, happy-lib:grammar, happy-lib:tabular + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts + ghc-options: -Wall -Wno-incomplete-uni-patterns + other-modules: Paths_happy_lib + autogen-modules: Paths_happy_lib + +library backend-glr + hs-source-dirs: backend-glr/src + + exposed-modules: Happy.Backend.GLR, + Happy.Backend.GLR.ProduceCode + build-depends: base < 5, array, happy-lib:grammar, happy-lib:tabular + + default-language: Haskell98 + default-extensions: CPP, MagicHash, FlexibleContexts + ghc-options: -Wall -Wno-incomplete-uni-patterns + other-modules: Paths_happy_lib + autogen-modules: Paths_happy_lib + +library + reexported-modules: Happy.Grammar, + Happy.Frontend, + Happy.Frontend.AbsSyn, + Happy.Frontend.Mangler, + Happy.Frontend.PrettyGrammar, + Happy.Tabular, + Happy.Tabular.First, + Happy.Tabular.Info, + Happy.Tabular.LALR, + Happy.Tabular.NameSet, + Happy.Backend.LALR, + Happy.Backend.LALR.ProduceCode, + Happy.Backend.GLR, + Happy.Backend.GLR.ProduceCode + + build-depends: base >= 4.9 && < 5, + array >= 0.5, + containers >= 0.4.2, + transformers >= 0.5.6.2, + mtl >= 2.2.1, + happy-lib:grammar, + happy-lib:tabular, + happy-lib:frontend, + happy-lib:backend-lalr, + happy-lib:backend-glr + default-language: Haskell98 diff --git a/packages/tabular/LICENSE b/lib/tabular/LICENSE similarity index 100% rename from packages/tabular/LICENSE rename to lib/tabular/LICENSE diff --git a/packages/tabular/Setup.hs b/lib/tabular/Setup.hs similarity index 100% rename from packages/tabular/Setup.hs rename to lib/tabular/Setup.hs diff --git a/packages/tabular/src/Happy/Tabular.lhs b/lib/tabular/src/Happy/Tabular.lhs similarity index 100% rename from packages/tabular/src/Happy/Tabular.lhs rename to lib/tabular/src/Happy/Tabular.lhs diff --git a/packages/tabular/src/Happy/Tabular/First.lhs b/lib/tabular/src/Happy/Tabular/First.lhs similarity index 100% rename from packages/tabular/src/Happy/Tabular/First.lhs rename to lib/tabular/src/Happy/Tabular/First.lhs diff --git a/packages/tabular/src/Happy/Tabular/Info.lhs b/lib/tabular/src/Happy/Tabular/Info.lhs similarity index 100% rename from packages/tabular/src/Happy/Tabular/Info.lhs rename to lib/tabular/src/Happy/Tabular/Info.lhs diff --git a/packages/tabular/src/Happy/Tabular/LALR.lhs b/lib/tabular/src/Happy/Tabular/LALR.lhs similarity index 100% rename from packages/tabular/src/Happy/Tabular/LALR.lhs rename to lib/tabular/src/Happy/Tabular/LALR.lhs diff --git a/packages/tabular/src/Happy/Tabular/NameSet.hs b/lib/tabular/src/Happy/Tabular/NameSet.hs similarity index 100% rename from packages/tabular/src/Happy/Tabular/NameSet.hs rename to lib/tabular/src/Happy/Tabular/NameSet.hs diff --git a/packages/backend-glr/happy-backend-glr.cabal b/packages/backend-glr/happy-backend-glr.cabal deleted file mode 100644 index ed89af01..00000000 --- a/packages/backend-glr/happy-backend-glr.cabal +++ /dev/null @@ -1,60 +0,0 @@ -name: happy-backend-glr -version: 2.0 -license: BSD2 -license-file: LICENSE -copyright: (c) Andy Gill, Simon Marlow -author: Andy Gill and Simon Marlow -maintainer: Simon Marlow -bug-reports: https://github.com/haskell/happy/issues -stability: stable -homepage: https://www.haskell.org/happy/ -category: Development -cabal-version: >= 1.10 -build-type: Simple -synopsis: A GLR backend for happy - -Description: - Happy is a parser generator for Haskell. - Happy-Backend-GLR is a backend which creates - GLR-based Haskell code. - - -tested-with: - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 - GHC == 9.4.8 - GHC == 9.2.8 - GHC == 9.0.2 - GHC == 8.10.7 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 - -data-dir: data - -data-files: - GLR_Base.hs - GLR_Lib.hs - -library - hs-source-dirs: src - - exposed-modules: Happy.Backend.GLR, - Happy.Backend.GLR.ProduceCode - build-depends: base < 5, - array, - happy-grammar == 2.0, - happy-tabular == 2.0 - - default-language: Haskell98 - default-extensions: CPP, MagicHash, FlexibleContexts - ghc-options: -Wall -Wincomplete-uni-patterns - other-modules: Paths_happy_backend_glr diff --git a/packages/backend-lalr/happy-backend-lalr.cabal b/packages/backend-lalr/happy-backend-lalr.cabal deleted file mode 100644 index 8ec6a312..00000000 --- a/packages/backend-lalr/happy-backend-lalr.cabal +++ /dev/null @@ -1,59 +0,0 @@ -name: happy-backend-lalr -version: 2.0 -license: BSD2 -license-file: LICENSE -copyright: (c) Andy Gill, Simon Marlow -author: Andy Gill and Simon Marlow -maintainer: Simon Marlow -bug-reports: https://github.com/haskell/happy/issues -stability: stable -homepage: https://www.haskell.org/happy/ -category: Development -cabal-version: >= 1.10 -build-type: Simple -synopsis: A table-based backend for happy - -Description: - Happy is a parser generator for Haskell. - Happy-Backend-LALR is responsible for code-generation: - It converts action and goto tables into LALR Haskell code. - - -tested-with: - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 - GHC == 9.4.8 - GHC == 9.2.8 - GHC == 9.0.2 - GHC == 8.10.7 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 - -data-dir: data - -data-files: - HappyTemplate.hs - -library - hs-source-dirs: src - - exposed-modules: Happy.Backend.LALR, - Happy.Backend.LALR.ProduceCode - build-depends: base < 5, - array, - happy-grammar == 2.0, - happy-tabular == 2.0 - - default-language: Haskell98 - default-extensions: CPP, MagicHash, FlexibleContexts - ghc-options: -Wall -Wincomplete-uni-patterns - other-modules: Paths_happy_backend_lalr diff --git a/packages/frontend/happy-frontend.cabal b/packages/frontend/happy-frontend.cabal deleted file mode 100644 index fbfda50a..00000000 --- a/packages/frontend/happy-frontend.cabal +++ /dev/null @@ -1,68 +0,0 @@ -name: happy-frontend -version: 2.0 -license: BSD2 -license-file: LICENSE -copyright: (c) Andy Gill, Simon Marlow -author: Andy Gill and Simon Marlow -maintainer: Simon Marlow -bug-reports: https://github.com/haskell/happy/issues -stability: stable -homepage: https://www.haskell.org/happy/ -category: Development -cabal-version: >= 1.10 -build-type: Simple -synopsis: A yacc-like frontend for happy - -Description: - Happy is a parser generator for Haskell. - Happy-Frontend is responsible for parsing .y- and .ly-files - and mangling them into a Grammar datatype. - These .y- and .ly-files work similar to yacc's .y-files, but - have some Haskell-specific features. - -tested-with: - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 - GHC == 9.4.8 - GHC == 9.2.8 - GHC == 9.0.2 - GHC == 8.10.7 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 - -library - hs-source-dirs: src - exposed-modules: Happy.Frontend, - Happy.Frontend.AbsSyn, - Happy.Frontend.Mangler, - Happy.Frontend.PrettyGrammar - - build-depends: base < 5, - array, - containers >= 0.4.2, - transformers >= 0.5.6.2, - mtl >= 2.2.2, - happy-grammar == 2.0 - - default-language: Haskell98 - default-extensions: CPP, MagicHash, FlexibleContexts - ghc-options: -Wall -Wincomplete-uni-patterns -Wno-incomplete-uni-patterns - other-modules: - Happy.Frontend.ParseMonad - Happy.Frontend.ParseMonad.Class - Happy.Frontend.Mangler.Monad - Happy.Frontend.Parser - Happy.Frontend.Lexer - Happy.Frontend.ParamRules - Happy.Frontend.AttrGrammar - Happy.Frontend.AttrGrammar.Parser - Happy.Frontend.AttrGrammar.Mangler diff --git a/packages/grammar/happy-grammar.cabal b/packages/grammar/happy-grammar.cabal deleted file mode 100644 index 139b0378..00000000 --- a/packages/grammar/happy-grammar.cabal +++ /dev/null @@ -1,50 +0,0 @@ -name: happy-grammar -version: 2.0 -license: BSD2 -license-file: LICENSE -copyright: (c) Andy Gill, Simon Marlow -author: Andy Gill and Simon Marlow -maintainer: Simon Marlow -bug-reports: https://github.com/haskell/happy/issues -stability: stable -homepage: https://www.haskell.org/happy/ -category: Development -cabal-version: >= 1.10 -build-type: Simple -synopsis: happy's Grammar datatype - -Description: - Happy is a parser generator for Haskell. - Happy-Grammar exposes the cross-package Grammar datatype, - which represents a grammar as can be parsed and processed by happy. - -tested-with: - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 - GHC == 9.4.8 - GHC == 9.2.8 - GHC == 9.0.2 - GHC == 8.10.7 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 - -library - hs-source-dirs: src - - exposed-modules: Happy.Grammar - build-depends: base < 5, - array - - default-language: Haskell98 - default-extensions: CPP, MagicHash, FlexibleContexts - ghc-options: -Wall - other-modules: diff --git a/packages/tabular/happy-tabular.cabal b/packages/tabular/happy-tabular.cabal deleted file mode 100644 index 87bcc916..00000000 --- a/packages/tabular/happy-tabular.cabal +++ /dev/null @@ -1,56 +0,0 @@ -name: happy-tabular -version: 2.0 -license: BSD2 -license-file: LICENSE -copyright: (c) Andy Gill, Simon Marlow -author: Andy Gill and Simon Marlow -maintainer: Simon Marlow -bug-reports: https://github.com/haskell/happy/issues -stability: stable -homepage: https://www.haskell.org/happy/ -category: Development -cabal-version: >= 1.10 -build-type: Simple -synopsis: Action and goto tables for happy - -Description: - Happy is a parser generator for Haskell. - Happy-Tabular converts `Grammar`s, coming from - a frontend, into LALR action and goto tables, - which are further processed by a backend. - -tested-with: - GHC == 9.10.1 - GHC == 9.8.2 - GHC == 9.6.5 - GHC == 9.4.8 - GHC == 9.2.8 - GHC == 9.0.2 - GHC == 8.10.7 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 --- GHC == 7.10.3 --- GHC == 7.8.4 --- GHC == 7.6.3 --- GHC == 7.4.2 --- GHC == 7.0.4 - -library - hs-source-dirs: src - - exposed-modules: Happy.Tabular, - Happy.Tabular.First, - Happy.Tabular.Info, - Happy.Tabular.LALR, - Happy.Tabular.NameSet - build-depends: base < 5, - array, - containers >= 0.4.2, - happy-grammar == 2.0 - - default-language: Haskell98 - default-extensions: CPP, MagicHash, FlexibleContexts, NamedFieldPuns - ghc-options: -Wall