1
0
forked from GitHub/gf-core
Commit Graph

49 Commits

Author SHA1 Message Date
krasimir
4ff6728993 fix the missmatch between Int and CInt in the Haskell binding to the word alignment API. This was causing problems on 64-bit machines 2015-02-18 17:05:35 +00:00
krasimir
f3f47c7761 fix the callback for unknown words as well 2015-02-18 16:47:33 +00:00
krasimir
4ed41214e5 fix in the callback for names in the Haskell binding 2015-02-18 16:41:13 +00:00
kr.angelov
1baba82fe5 added hasLinearization in the Haskell binding 2015-01-30 13:05:57 +00:00
hallgren
ed502c490c PGF2: fixes for named entity callback function 2015-01-21 13:54:48 +00:00
hallgren
ec8b4fec93 PGF2 & PGFService: enable callbacks for named entities and chunks in the c-parse & c-translate web requests 2015-01-21 10:41:12 +00:00
kr.angelov
60cb95258b fix conflicts 2015-01-21 08:35:20 +00:00
kr.angelov
07eb8fec26 added functionType in the Haskell API to the C runtime 2015-01-20 14:45:02 +00:00
hallgren
7577de236f PGF2 & PGFService: work in progress on callbacks for nerc & chunks 2015-01-20 14:57:52 +00:00
hallgren
4372b47d2a PGF2: introduced some type synonyms to make type signature more readable 2015-01-20 12:57:33 +00:00
kr.angelov
328d4df660 API for word alignment in the C runtime and in the Haskell binding 2014-12-29 10:59:20 +00:00
kr.angelov
adb9e29dc4 bugfix and tiny optimization for callbacks from Haskell 2014-12-19 10:14:41 +00:00
kr.angelov
705ffaa33d haddock comments for parseWithHeuristics 2014-12-19 09:05:51 +00:00
kr.angelov
022849482d added mkStr to the Haskell binding 2014-12-19 08:58:02 +00:00
kr.angelov
fdc6c9a3cd added mkApp to the Haskell binding 2014-12-19 08:47:00 +00:00
kr.angelov
467a308335 fix in the Haskell binding 2014-12-16 10:35:56 +00:00
kr.angelov
c192aed5ba forgot to export parseWithHeuristics from Haskell 2014-12-16 10:33:45 +00:00
kr.angelov
9b7e18c25e change in the API for literals
The API in the C runtime as well as in the Haskell, Python and Java binding
is changed. Now instead of adding the literal callbacks to the concrete syntax
you need to supply them every time when you need to parse. The main reason is:

- referentially transparent API for Haskell
- when we start using memory mapped files we will not be allowed to change
  anything in the grammar data structures. At that point the old API would
  be impossible to use.
2014-12-16 10:21:26 +00:00
kr.angelov
57f7b61c6b throw away the long obsolete runtime type information in the C runtime 2014-10-09 13:44:26 +00:00
hallgren
38811b06c9 haskell-bind/PGF2.hsc: unexport functions that break referential transparency
loadConcr, unloadConcr and addLiteral modify the Concr structure as a side
effect. This means that other functions with a Concr argument (e.g. parse
and linearize) are no longer pure.

Possible solutions:

1. Don't try to hide the imperative nature of the C run-time system: remove
   all uses of unsafePerformIO and let all functions operate in the IO monad.

2. Don't export functions with side effects. Perhaps the desired functionality
   of loadConcr, unloadConcr and addLiteral can be folded into readPGF.
   The Concr structures can then treaded as immutable after after the
   readPGF function returns...
2014-09-22 14:05:17 +00:00
kr.angelov
5c0ef5c4ed now release the FunPtr:s that are allocated for each literal callback 2014-09-10 15:41:53 +00:00
kr.angelov
d84d3b5763 added an API for custom literals in the Haskell binding 2014-09-10 14:56:18 +00:00
kr.angelov
fb18482aeb added loadConcr/unloadConcr to the Haskell binding. This exposes an API for loading grammars compiled with -split-pgf 2014-09-10 14:35:54 +00:00
kr.angelov
21e855c91d fixed memory leak in the Haskell binding to the C runtime 2014-06-16 08:49:13 +00:00
hallgren
f739841497 PGF library: expose only PGF and PGF.Internal instead of all modules
PGF exports the public, stable API.
PGF.Internal exports additional things needed in the GF compiler & shell,
including the nonstardard version of Data.Binary.
2014-06-12 14:43:18 +00:00
hallgren
bc0249b501 PGF2.hsc: use throwIO instead of throw
From the documentation: the throwIO variant should be used in preference to
throw to raise an exception within the IO monad because it guarantees ordering
with respect to other IO operations, whereas throw does not.

Also removed some unused imports.
2014-06-10 12:42:01 +00:00
hallgren
33af15e803 Haskell binding: free memory pool to avoid space leak when readPGF fails 2014-05-13 14:07:36 +00:00
kr.angelov
c2ae35cfb2 fix memory leak in the Haskell binding 2014-05-08 08:41:58 +00:00
hallgren
b3d92a1378 pgf-shell.hs: fix compilation problem with GHC 7.4 2014-05-07 17:06:34 +00:00
hallgren
7c88b7935f Two improvements in the pgf-shell example
1. Like pgf-translate, it now shows one result at a time, press Enter to get
   more results.
2. You can load a new grammar with the command 'i <path-to-pgf>'
2014-05-07 16:37:28 +00:00
kr.angelov
268e7a697f fix the haskell binding to handle parse errors 2014-04-04 11:46:40 +00:00
hallgren
6abd0c8eef haskell-bind: comment out superfluous imports 2014-03-12 13:21:47 +00:00
hallgren
be31b52e07 Restore compatibility with GHC 7.0 2014-02-10 21:44:34 +00:00
kr.angelov
2451ed123d proper error checking in the C runtime 2014-02-10 14:07:17 +00:00
hallgren
1efb9824f8 haskell-bind: fix broken pgf-shell
The type CId was replaced with String, so can't use show and read anymore.
2014-02-10 12:59:31 +00:00
kr.angelov
0e2c3f86a6 bugfix in pgf2-bind.cabal 2014-02-10 10:28:19 +00:00
kr.angelov
e11a247d82 updated haskell-bind/README 2014-02-09 20:56:01 +00:00
kr.angelov
e527a526d8 cleanup the code for the FFI binding. The API is now more uniform with the Python and the Java bindings. Fixed a lot of memory leaks. 2014-02-09 20:45:11 +00:00
hallgren
96594e405d pgf-shell: show the names of the concrete syntaxes after loading the grammar 2014-02-07 16:40:13 +00:00
inari
ea49a7b388 haskell-bind: add function languages 2014-02-07 15:56:12 +00:00
hallgren
d1ab3072db pgf-shell: enable -rtsopts, call performGC between commands
This is to make it easier to find the cause of space leaks.
2014-02-07 13:57:13 +00:00
inari
13e7d3e518 fixed some memory leaks 2014-02-06 10:50:59 +00:00
inari
bdf297d0b1 changes to pools in haskell bindings 2014-01-29 16:02:07 +00:00
hallgren
b8f3914209 Optionally include C run-time support
If the C run-time library is compiled and installed on your system, you can now
do 'cabal configure -fc-runtime' to get the following extras:
  + The haskell binding to the C run-time library will be included in the
    PGF library (so you can import it in Haskell applications).
    Documentation on the new modules will be included when you run
    'cabal haddock'.
  + The new command 'pgf-shell', implemented on top of haskell binding to
    the C run-time system.
  + Three new commands in the web API: c-parse, c-linearize and
    c-translate. Their interfaces are similar to the corresponding commands
    without the "c-" prefix, but they should be considered preliminary.
2014-01-20 17:06:11 +00:00
hallgren
1631a46040 haskell-bind: add an export list to hide internal stuff
It also makes the generated haddock documentaiton more structured.
2014-01-20 14:40:38 +00:00
hallgren
29d1b58ff5 haskell-bind.cabal: relax overly restrictive version bounds and add cc-options 2014-01-17 14:18:20 +00:00
hallgren
4226be69e8 haskell-bind: add a cabal file and examples/pgf-shell.hs
* The haskell-bind.cabal file makes it easy to build the haskell binding and
  use it in ghci.
* pgf-shell.hs is a simple example of how to use the haskell binding.
2014-01-17 14:02:35 +00:00
hallgren
33024f3130 haskell-bind: change the type of CRuntimeFFI.getConcr
Change the type of getConcr from

    getConcr :: PGF -> Language -> Concr

to

    getConcr :: PGF -> Language -> Maybe Concr

This is to prevent programs from crashing later if you try to select a
concrete syntax that is not present in a grammar.
2014-01-17 13:58:48 +00:00
kr.angelov
e4246d090c move src/runtime/haskell/CRuntimeFFI to src/runtime/haskell-bind. Don't mess up with the stable Haskell runtime! 2013-12-10 16:11:47 +00:00