From 38f468eed3325d5e435021b8b137f80545f22a95 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Sat, 11 Jul 2020 21:06:08 +0200 Subject: (pgf2) Readme, license, changelog --- src/runtime/haskell-bind/README.md | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 src/runtime/haskell-bind/README.md (limited to 'src/runtime/haskell-bind/README.md') diff --git a/src/runtime/haskell-bind/README.md b/src/runtime/haskell-bind/README.md new file mode 100644 index 000000000..a4ce0ef20 --- /dev/null +++ b/src/runtime/haskell-bind/README.md @@ -0,0 +1,46 @@ +# PGF2 + +This is a Haskell binding to the PGF runtime in C. + +The exposed modules are: + +- `PGF2`: a user API similar to Python and Java APIs +- `PGF2.Internal`: an internal module with FFI definitions for the relevant C functions + +## How to compile + +``` +cabal install +``` + +**Note:** you must have the PGF C runtime already installed and available. +See + +## How to use + +Import PGF to the Haskell program that you're writing. +The Cabal infrastructure will make sure to tell the compiler +where to find the relevant modules. + +## Example + +```haskell +module Main where + +import PGF2 +import qualified Data.Map as Map + +main = do + pgf <- readPGF "App12.pgf" + let Just eng = Map.lookup "AppEng" (languages pgf) + + -- Parsing + let res = parse eng (startCat pgf) "this is a small theatre" + let ParseOk ((tree,prob):rest) = res + print tree + + -- Linearisation + let Just expr = readExpr "AdjCN (PositA red_A) (UseN theatre_N)" + let s = linearize eng expr + print s +``` -- cgit v1.2.3 From f00f0cb0ef46d1a203e9d4ac238ec1a2e867fd51 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 28 Jul 2020 22:36:49 +0200 Subject: Bump pgf2 to 1.2.0 --- src/runtime/haskell-bind/CHANGELOG.md | 6 ++++++ src/runtime/haskell-bind/README.md | 17 +++++++++-------- src/runtime/haskell-bind/pgf2.cabal | 30 +++++++++++++++--------------- src/runtime/haskell-bind/stack.yaml | 1 + 4 files changed, 31 insertions(+), 23 deletions(-) create mode 100644 src/runtime/haskell-bind/stack.yaml (limited to 'src/runtime/haskell-bind/README.md') diff --git a/src/runtime/haskell-bind/CHANGELOG.md b/src/runtime/haskell-bind/CHANGELOG.md index e3d6410fa..e9da7fac4 100644 --- a/src/runtime/haskell-bind/CHANGELOG.md +++ b/src/runtime/haskell-bind/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.2.0 + +- Stop `pgf-shell` from being built by default. +- parseToChart also returns the category. +- bugfix in bracketedLinearize. + ## 1.1.0 - Remove SG library. diff --git a/src/runtime/haskell-bind/README.md b/src/runtime/haskell-bind/README.md index a4ce0ef20..f136ad2da 100644 --- a/src/runtime/haskell-bind/README.md +++ b/src/runtime/haskell-bind/README.md @@ -1,6 +1,6 @@ # PGF2 -This is a Haskell binding to the PGF runtime in C. +This is a Haskell binding to the PGF runtime written in C. The exposed modules are: @@ -9,18 +9,19 @@ The exposed modules are: ## How to compile -``` -cabal install -``` - **Note:** you must have the PGF C runtime already installed and available. See +Once the runtine is installed, you can use: + +``` +cabal install pgf2 +``` + ## How to use -Import PGF to the Haskell program that you're writing. -The Cabal infrastructure will make sure to tell the compiler -where to find the relevant modules. +Simply import `PGF2` in your Haskell program. +The Cabal infrastructure will make sure to tell the compiler where to find the relevant modules. ## Example diff --git a/src/runtime/haskell-bind/pgf2.cabal b/src/runtime/haskell-bind/pgf2.cabal index f0cc65e70..a4e113f3b 100644 --- a/src/runtime/haskell-bind/pgf2.cabal +++ b/src/runtime/haskell-bind/pgf2.cabal @@ -1,6 +1,6 @@ name: pgf2 -version: 1.1.0 -synopsis: Bindings to the PGF runtime in C +version: 1.2.0 +synopsis: Bindings to the C version of the PGF runtime description: GF, Grammatical Framework, is a programming language for multilingual grammar applications. GF grammars are compiled into Portable Grammar Format (PGF) which can be used with the PGF runtime, written in C. @@ -9,7 +9,7 @@ homepage: https://www.grammaticalframework.org license: LGPL-3 license-file: LICENSE author: Krasimir Angelov -maintainer: Krasimir Angelov, John J. Camilleri +maintainer: kr.angelov@gmail.com category: Language build-type: Simple extra-source-files: CHANGELOG.md, README.md @@ -33,15 +33,15 @@ library cc-options: -std=c99 c-sources: utils.c -executable pgf-shell - main-is: pgf-shell.hs - hs-source-dirs: examples - build-depends: - base, - containers, - lifted-base, - mtl, - pgf2 - default-language: Haskell2010 - if impl(ghc>=7.0) - ghc-options: -rtsopts +-- executable pgf-shell +-- main-is: pgf-shell.hs +-- hs-source-dirs: examples +-- build-depends: +-- base, +-- containers, +-- lifted-base, +-- mtl, +-- pgf2 +-- default-language: Haskell2010 +-- if impl(ghc>=7.0) +-- ghc-options: -rtsopts diff --git a/src/runtime/haskell-bind/stack.yaml b/src/runtime/haskell-bind/stack.yaml new file mode 100644 index 000000000..3d69a763f --- /dev/null +++ b/src/runtime/haskell-bind/stack.yaml @@ -0,0 +1 @@ +resolver: lts-12.26 # ghc 8.4.4 -- cgit v1.2.3 From c53353f08763fbbfb5c0abeaa03da6a23aa64080 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 28 Jul 2020 22:54:34 +0200 Subject: Updates to PGF2 readme --- src/runtime/haskell-bind/README.md | 15 ++++++++++++--- src/runtime/haskell-bind/stack.yaml | 2 ++ 2 files changed, 14 insertions(+), 3 deletions(-) (limited to 'src/runtime/haskell-bind/README.md') diff --git a/src/runtime/haskell-bind/README.md b/src/runtime/haskell-bind/README.md index f136ad2da..1cb68df65 100644 --- a/src/runtime/haskell-bind/README.md +++ b/src/runtime/haskell-bind/README.md @@ -9,13 +9,22 @@ The exposed modules are: ## How to compile -**Note:** you must have the PGF C runtime already installed and available. +**Important:** You must have the C runtime already installed and available on your system. See -Once the runtine is installed, you can use: +Once the runtine is installed, you can install the library to your global Cabal installation: ``` -cabal install pgf2 +cabal install pgf2 --extra-lib-dirs=/usr/local/lib +``` + +or add it to your `stack.yaml` file: + +```yaml +extra-deps: + - pgf2 +extra-lib-dirs: + - /usr/local/lib ``` ## How to use diff --git a/src/runtime/haskell-bind/stack.yaml b/src/runtime/haskell-bind/stack.yaml index 3d69a763f..3b1a3092b 100644 --- a/src/runtime/haskell-bind/stack.yaml +++ b/src/runtime/haskell-bind/stack.yaml @@ -1 +1,3 @@ +# This is mainly here so that I can run `stack sdist` for uploading to Hackage + resolver: lts-12.26 # ghc 8.4.4 -- cgit v1.2.3