summaryrefslogtreecommitdiff
path: root/doc/gf-developers.t2t
diff options
context:
space:
mode:
Diffstat (limited to 'doc/gf-developers.t2t')
-rw-r--r--doc/gf-developers.t2t115
1 files changed, 38 insertions, 77 deletions
diff --git a/doc/gf-developers.t2t b/doc/gf-developers.t2t
index 8c91ccc96..2c8aded0d 100644
--- a/doc/gf-developers.t2t
+++ b/doc/gf-developers.t2t
@@ -162,94 +162,63 @@ Configuring gf-3.x...
setup: Distribution/Simple/PackageIndex.hs:124:8-13: Assertion failed
```
-The exact cause of this problem is unclear, but it seems to happen
-during the configure phase if the same version of GF is already installed,
-so a workaround is to remove the existing installation with
+== Compiling GF with C runtime system support ==
-```
-ghc-pkg unregister gf
-```
+The C runtime system is a separate implementation of the PGF runtime services.
+It makes it possible to work with very large, ambiguous grammars, using
+probabilistic models to obtain probable parses. The C runtime system might
+also be easier to use than the Haskell runtime system on certain platforms,
+e.g. Android and iOS.
-You can check with ``ghc-pkg list gf`` that it is gone.
+To install the C runtime system, go to the ``src/runtime/c`` directory.
-== Compilation with make ==
+- **On Linux and Mac OS —**
+ You should have autoconf, automake, libtool and make.
+ If you are missing some of them, follow the
+ instructions in the [INSTALL https://github.com/GrammaticalFramework/gf-core/blob/master/src/runtime/c/INSTALL] file.
-If you feel more comfortable with Makefiles then there is a thin Makefile
-wrapper arround Cabal for you. If you just type:
-```
-$ make
-```
-the configuration phase will be run automatically if needed and after that
-the sources will be compiled.
+ Once you have the required libraries, the easiest way to install the C runtime is to use the ``install.sh`` script. Just type
-%% cabal build rgl-none does not work with recent versions of Cabal
-%If you don't want to compile the resource library
-%every time then you can use:
-%```
-%$ make gf
-%```
+ ``$ bash install.sh``
-For installation use:
-```
-$ make install
-```
-For cleaning:
-```
-$ make clean
-```
-%and to build source distribution archive run:
-%```
-%$ make sdist
-%```
+ This will install the C header files and libraries need to write C programs
+ that use PGF grammars.
-== Compiling GF with C run-time system support ==
+% If this doesn't work for you, follow the manual instructions in the [INSTALL https://github.com/GrammaticalFramework/gf-core/blob/master/src/runtime/c/INSTALL] file under your operating system.
+
+- **On other operating systems —** Follow the instructions in the
+[INSTALL https://github.com/GrammaticalFramework/gf-core/blob/master/src/runtime/c/INSTALL] file under your operating system.
-The C run-time system is a separate implementation of the PGF run-time services.
-It makes it possible to work with very large, ambiguous grammars, using
-probabilistic models to obtain probable parses. The C run-time system might
-also be easier to use than the Haskell run-time system on certain platforms,
-e.g. Android and iOS.
-To install the C run-time system, go to the ``src/runtime/c`` directory
-%and follow the instructions in the ``INSTALL`` file.
-and use the ``install.sh`` script:
-```
-bash setup.sh configure
-bash setup.sh build
-bash setup.sh install
-```
-This will install
-the C header files and libraries need to write C programs that use PGF grammars.
-% Some example C programs are included in the ``utils`` subdirectory, e.g. ``pgf-translate.c``.
Depending on what you want to do with the C runtime, you can follow one or more of the following steps.
-=== 1. Use the C runtime from another programming language ===
+=== Use the C runtime from another programming language ===[bindings]
% **If you just want to use the C runtime from Python, Java, or Haskell, you don't need to change your GF installation.**
-==== What ====
-
-**This is the most common use case for the C runtime:** compile
+- **What —**
+This is the most common use case for the C runtime: compile
your GF grammars into PGF with the standard GF executable,
and manipulate the PGFs from another programming language,
using the bindings to the C runtime.
-==== How ====
+- **How —**
The Python, Java and Haskell bindings are found in the
``src/runtime/{python,java,haskell-bind}`` directories,
respecively. Compile them by following the instructions
in the ``INSTALL`` or ``README`` files in those directories.
The Python library can also be installed from PyPI using ``pip install pgf``.
-(If you are on Mac and get an error about ``clang`` version, you can try
-some of [these solutions https://stackoverflow.com/questions/63972113/big-sur-clang-invalid-version-error-due-to-macosx-deployment-target]—but be careful before removing any existing installations.)
-=== 2. Use GF shell with C runtime support ===
+//If you are on Mac and get an error about ``clang`` version, you can try some of [these solutions https://stackoverflow.com/questions/63972113/big-sur-clang-invalid-version-error-due-to-macosx-deployment-target]—but be careful before removing any existing installations.//
+
+
+=== Use GF shell with C runtime support ===
-==== What ====
+- **What —**
If you want to use the GF shell with C runtime functionalities, then you need to (re)compile GF with special flags.
The GF shell can be started with ``gf -cshell`` or ``gf -crun`` to use
@@ -259,19 +228,18 @@ modes (use the ``help`` command in the shell for details).
(Re)compiling your GF with these flags will also give you
Haskell bindings to the C runtime, as a library called ``PGF2``,
-but if you want Python or Java bindings, you need to do step 1.
+but if you want Python or Java bindings, you need to do [the previous step #bindings].
% ``PGF2``: a module to import in Haskell programs, providing a binding to the C run-time system.
-==== How ====
-
+- **How —**
If you use cabal, run the following command:
```
cabal install -fc-runtime
```
-from the top directory.
+from the top directory (``gf-core``).
If you use stack, uncomment the following lines in the ``stack.yaml`` file:
@@ -282,26 +250,20 @@ flags:
extra-lib-dirs:
- /usr/local/lib
```
+and then run ``stack install`` from the top directory (``gf-core``).
-First you will need to install the following libraries if not already installed:
-autoconf, automake, libtool, make
-On Ubuntu ``apt-get install autotools-dev``
-On Fedora ``dnf install autoconf automake libtool``
-
-and then run ``stack install``, also from the top directory.
+//If you get an "``error while loading shared libraries``" when trying to run GF with C runtime, remember to declare your ``LD_LIBRARY_PATH``.//
+//Add ``export LD_LIBRARY_PATH="/usr/local/lib"`` to either your ``.bashrc`` or ``.profile``. You should now be able to start GF with C runtime.//
-If you get an error ``error while loading shared libraries`` when trying to run gf with C runtime, remember to declare your LD_LIBRARY_PATH. Add ``export LD_LIBRARY_PATH="/usr/local/lib"`` to either your .bashrc or .profile. You should now be able to start GF with C runtime.
-=== 3. Use GF server mode with C runtime ===
-
-==== What ====
+=== Use GF server mode with C runtime ===
+- **What —**
With this feature, ``gf -server`` mode is extended with new requests to call the C run-time
system, e.g. ``c-parse``, ``c-linearize`` and ``c-translate``.
-==== How ====
-
+- **How —**
If you use cabal, run the following command:
```
@@ -309,8 +271,7 @@ cabal install -fc-runtime -fserver
```
from the top directory.
-If you use stack, add the following lines in the
-If you use stack, uncomment the following lines in the ``stack.yaml`` file:
+If you use stack, add the following lines in the ``stack.yaml`` file:
```
flags: