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/happy-backend-glr.cabal b/lib/backend-glr/happy-backend-glr.cabal similarity index 72% rename from packages/backend-glr/happy-backend-glr.cabal rename to lib/backend-glr/happy-backend-glr.cabal index ed89af01..ba3e2b88 100644 --- a/packages/backend-glr/happy-backend-glr.cabal +++ b/lib/backend-glr/happy-backend-glr.cabal @@ -15,9 +15,15 @@ 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. + This library translates the LR action and goto tables computed from a grammar + description into table-driven GLR parsing code in Haskell. + Ambiguous parses produce multiple parse trees. + The library happy-grammar defines the 'Grammar' AST type for grammar files. + The library happy-frontend provides a parser for happy grammar files (.y) to + produce a 'Grammar'. + The library happy-tabular computes the LR action and goto tables for the + given 'Grammar' and defines the data types representing said tables. tested-with: GHC == 9.10.1 @@ -57,4 +63,4 @@ library default-language: Haskell98 default-extensions: CPP, MagicHash, FlexibleContexts ghc-options: -Wall -Wincomplete-uni-patterns - other-modules: Paths_happy_backend_glr + other-modules: Paths_happy_lib 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/happy-backend-lalr.cabal b/lib/backend-lalr/happy-backend-lalr.cabal similarity index 67% rename from packages/backend-lalr/happy-backend-lalr.cabal rename to lib/backend-lalr/happy-backend-lalr.cabal index 8ec6a312..22f09cbc 100644 --- a/packages/backend-lalr/happy-backend-lalr.cabal +++ b/lib/backend-lalr/happy-backend-lalr.cabal @@ -15,9 +15,17 @@ 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. + This library translates LR action and goto tables computed from a grammar + description into table-driven deterministic parsing code in Haskell. + (Any shift/reduce conflicts are resolved in favour of shifting, + while any reduce/reduce conflicts are resolved in favour of the rule with the + lower number.) + The library happy-grammar defines the 'Grammar' AST type for grammar files. + The library happy-frontend provides a parser for happy grammar files (.y) to + produce a 'Grammar'. + The library happy-tabular computes the LR action and goto tables for the + given 'Grammar' and defines the data types representing said tables. tested-with: GHC == 9.10.1 @@ -56,4 +64,4 @@ library default-language: Haskell98 default-extensions: CPP, MagicHash, FlexibleContexts ghc-options: -Wall -Wincomplete-uni-patterns - other-modules: Paths_happy_backend_lalr + other-modules: Paths_happy_lib 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/happy-frontend.cabal b/lib/frontend/happy-frontend.cabal similarity index 83% rename from packages/frontend/happy-frontend.cabal rename to lib/frontend/happy-frontend.cabal index fbfda50a..95694a89 100644 --- a/packages/frontend/happy-frontend.cabal +++ b/lib/frontend/happy-frontend.cabal @@ -15,11 +15,17 @@ 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. + This library provides a parser for happy grammar files (.y/.ly) to produce a + 'Grammar' AST type. These .y- and .ly-files work similar to yacc's .y-files, but have some Haskell-specific features. + The library happy-grammar defines the 'Grammar' AST type for grammar files. + The library happy-tabular computes the LR action and goto tables for the + given 'Grammar'. + The library happy-backend-lalr defines functions to produce Haskell code + for the LR action and goto tables. + tested-with: GHC == 9.10.1 GHC == 9.8.2 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/happy-grammar.cabal b/lib/grammar/happy-grammar.cabal similarity index 88% rename from packages/grammar/happy-grammar.cabal rename to lib/grammar/happy-grammar.cabal index 139b0378..7ee24929 100644 --- a/packages/grammar/happy-grammar.cabal +++ b/lib/grammar/happy-grammar.cabal @@ -15,9 +15,12 @@ synopsis: happy's Grammar datatype Description: Happy is a parser generator for Haskell. - Happy-Grammar exposes the cross-package Grammar datatype, + This library exposes the cross-package Grammar datatype, which represents a grammar as can be parsed and processed by happy. + The package happy-frontend provides a parser for happy grammar files (.y) to + produce a 'Grammar'. + tested-with: GHC == 9.10.1 GHC == 9.8.2 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/happy-tabular.cabal b/lib/tabular/happy-tabular.cabal similarity index 73% rename from packages/tabular/happy-tabular.cabal rename to lib/tabular/happy-tabular.cabal index 87bcc916..c5cae4af 100644 --- a/packages/tabular/happy-tabular.cabal +++ b/lib/tabular/happy-tabular.cabal @@ -15,9 +15,16 @@ 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. + For a given description of a happy grammar file (.y), + this library implements the text book computation of the LALR automaton and + generates the final LR action and goto tables, which are further processed by + a backend. + + The library happy-grammar defines the 'Grammar' AST type for grammar files. + The library happy-frontend provides a parser for happy grammar files (.y) to + produce a 'Grammar'. + The library happy-backend-lalr defines functions to produce Haskell code + for the LR action and goto tables. tested-with: GHC == 9.10.1 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