Commit Graph

3729 Commits

Author SHA1 Message Date
kr.angelov
621d748bac a major revision of the bytecode generator and JIT compiler. the effect is that now we can compute with lambda functions and with true tail recursion 2014-09-11 15:39:39 +00:00
kr.angelov
df0602723d now release the FunPtr:s that are allocated for each literal callback 2014-09-10 15:41:53 +00:00
kr.angelov
80725e872b added an API for custom literals in the Haskell binding 2014-09-10 14:56:18 +00:00
kr.angelov
b553729f37 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
hallgren
566aeb93f5 Wide Coverage Demo web app: use the App grammar instead of the Translate grammar
This gives faster but slightly lower quality translations.
2014-09-09 13:53:10 +00:00
hallgren
4eb6b55e98 (1) Refactor concurrency, (2) write to .gfo.tmp then rename to .gfo
(1) introduces the module GF.Infra.Concurreny with lifted concurrency
    operators (to reduce uses of liftIO) and some additional concurrency
    utilities, e.g. a function for sequential logging that is used in
    both GF.CompileInParallel and GFServer.
(2) avoids leaving broken .gfo files behind if compilation is aborted.
2014-09-08 15:43:20 +00:00
kr.angelov
4d28c7632e the code for def rules now uses proper graph update to preserve lazyness 2014-09-05 11:53:02 +00:00
kr.angelov
86b5f78c57 full support for recursive def rules in the C runtime 2014-09-05 10:09:43 +00:00
hallgren
a21ffc1941 gf.cabal, gf-server.cabal: add version bounds on network & httpd-shed
* httpd-shed-0.4 does not specify an upper bound on network, but it fails
  to build against network>=2.6. This is fixed in httpd-shed-0.4.0.2.
* With network-2.6, the Network.URI modules is moved to a separate package,
  so for the time being GF requires network>=2.3 && <2.6. This is compatible
  with the four most recent versions of the Haskell Platform.
2014-09-03 15:40:26 +00:00
hallgren
e0e6079c91 src/server: refactoring to isolate dependencies on the cgi/fastcgi packages
* Introducing the module CGI, re-exporting a subset of the cgi package. It
  might complete replace the cgi package in the future.
* Introducing the module CGIUtils, containing functions from FastCGIUtils that
  have nothing to do with fastcgi.

Some low level hackery with unsafePerformIO and global variables was left
in FastCGIUtils, but it is actually not used, neither for gf -server nor
exec/pgf-fcgi.hs.
2014-09-02 12:27:47 +00:00
kr.angelov
bfd414554d partial implementation for recursive def rules 2014-09-01 14:51:20 +00:00
kr.angelov
342f6e3797 bug fixes in the JIT compiler 2014-09-01 12:53:14 +00:00
kr.angelov
cee5f590ca added evaluator.h which I had forgoten 2014-08-29 08:36:53 +00:00
hallgren
fdf7d06f9a Fix GHC 7.4 compatibility issue caused by previous patch 2014-08-25 11:26:58 +00:00
hallgren
d84c5ef171 Experimental: parallel batch compilation of grammars
On my laptop these changes speed up the full build of the RGL and example
grammars with 'cabal build' from ~95s to ~43s and the zero build from ~18s
to ~5s.

The main change is the introduction of the module GF.CompileInParallel that
replaces GF.Compile and the function GF.Compile.ReadFiles.getAllFiles. At
present, it is activated with the new -j flag, and it is only used when
combined with --make or --batch. In addition, to get parallel computations,
you need to add GHC run-time flags, e.g., +RTS -N -A20M -RTS, to the command
line.

The Setup.hs script has been modified to pass the appropriate flags to GF
for parallel compilation when compiling the RGL and example grammars, but you
need a recent version of Cabal for this to work (probably >=1.20).

Some additonal refactoring were made during this work. A new monad is used to
avoid warnings/error messages from different modules to be intertwined when
compiling in parallel, so some functios that were hardiwred to the IO or IOE
monads have been lifted to work in arbitrary monads that are instances in
the appropriate classes.
2014-08-25 09:56:00 +00:00
kr.angelov
a39647d771 bugfix in the android app 2014-08-22 12:33:35 +00:00
hallgren
6bde56bef7 src/www/robots.txt: robot exclusion file for the GF cloud service.
To reduce potential server load caused by search bots.
2014-08-22 12:13:04 +00:00
hallgren
8dfaf2ef65 Command line flag -s/-q now silences all warnings
These flags now do what the say.
2014-08-22 00:30:33 +00:00
hallgren
21f429caf8 Add lifted directory operations in GF.System.Directory to eliminate the need for liftIO in various places 2014-08-20 17:47:08 +00:00
hallgren
73310add9a GF.CompileOne: refactoring to reduce code duplication and improve readability
I prefer small functions with descriptive names over large monilithic chunks
of code, so I grouped the compiler passes called from compileSourceModule
into funcitons named frontend, middle and backend. This also makes decisions
about which passes to run clearly visible up front.

Also made some small changes in GF.Compile.
2014-08-20 17:04:15 +00:00
hallgren
61760e4205 GF.Compile.ReadFiles: a simpler & faster way to convert from Latin1 to UTF-8 2014-08-19 14:27:15 +00:00
hallgren
60b5990792 Fix compliation error with GHC 7.4 caused by previous patch 2014-08-13 22:21:54 +00:00
hallgren
cd5193b7e1 Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8 2014-08-13 22:16:18 +00:00
hallgren
a06351b625 Refactoring in GF.Compile and GF.ReadFiles with an eye to parallel compilation
In particular, the function compileOne has been moved to the new module
GF.CompileOne and its type has been changed from

    compileOne :: ... -> CompileEnv -> FilePath -> IOE CompileEnv

to

    compileOne :: ... -> SourceGrammar -> FilePath -> IOE OneCompiledModule

making it more suitable for use in a parallel compiler.
2014-08-13 16:46:11 +00:00
hallgren
9093ff3fe5 GF.Compile: remove the Int from CompileEnv
It has been unused since the refresh pass was removed.
This eliminates one obstacle to parallel module compilation.
2014-08-11 16:30:11 +00:00
kr.angelov
c30e2df228 pattern matching in def rules is now supported 2014-08-11 15:53:41 +00:00
kr.angelov
d3b9652b81 revert an accidental change that I pushed together with the last patch 2014-08-11 11:44:49 +00:00
kr.angelov
584d589041 a partial support for def rules in the C runtime
The def rules are now compiled to byte code by the compiler and then to
native code by the JIT compiler in the runtime. Not all constructions
are implemented yet. The partial implementation is now in the repository
but it is not activated by default since this requires changes in the
PGF format. I will enable it only after it is complete.
2014-08-11 10:59:10 +00:00
hallgren
7a91afc02a Convert from Text.PrettyPrint to GF.Text.Pretty
All compiler modules now use GF.Text.Pretty instead of Text.PrettyPrint
2014-07-28 11:58:00 +00:00
hallgren
59172ce9c5 Adding GF.Infra.Location and GF.Text.Pretty (forgot to 'darcs add' them before) 2014-07-27 22:13:13 +00:00
hallgren
30cda51516 Introducing GF.Text.Pretty for more concise pretty printers and GF.Infra.Location for modularity
GF.Text.Pretty provides the class Pretty and overloaded versions of the pretty
printing combinators in Text.PrettyPrint, allowing pretty printable values to
be used directly instead of first having to convert them to Doc with functions
like text, int, char and ppIdent. Some modules have been converted to use
GF.Text.Pretty, but not all. Precedences could be added to simplify the pretty
printers for terms and patterns.

GF.Infra.Location contains the types Location and L, factored out from
GF.Grammar.Grammar, and the class HasSourcePath. This allowed the import
of GF.Grammar.Grammar to be removed from GF.Infra.CheckM, making it more
like a pure library module.
2014-07-27 22:06:23 +00:00
hallgren
3660339b23 PGF service: expire PGFs from the cache when they have been unused for 24 hours
...to keep memory use down on the server.
2014-07-21 15:53:38 +00:00
hallgren
3ec95e481b src/server/gf-server.cabal: update dependencies 2014-07-15 12:00:51 +00:00
john.j.camilleri
37a35734a5 PGF Web Service: include entire completion in full mode
When using full=yes in the web service 'complete' command,
you now get an additional field 'seq' with the longest possible completion.
So, given:

  lin
    f1 = ss "the" ;
    f2 = ss ("the red house" | "the real deal") ;

and trying to complete on input "th", you get:

    [
        {
            "from": "TestCnc",
            "brackets": {
                "cat": "_",
                "fid": 0,
                "index": 0,
                "fun": "_",
                "children": []
            },
            "text": "th",
            "completions": [
                {
                    "token": "the",
                    "funs": [
                        {
                            "fun": "f1",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the"
                        },
                        {
                            "fun": "f2",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the red house"
                        },
                        {
                            "fun": "f2",
                            "hyps": [],
                            "cat": "C",
                            "seq": "the real deal"
                        }
                    ]
                }
            ]
        }
    ]
2014-07-15 09:33:22 +00:00
john
9b49608451 PGF web service: Return additional completion info with 'full' flag
BETA! The 'complete' command now has a new flag 'full' which when set
returns additional info about completions.

Without 'full' flag (default):

[
    {
        "from": "PhrasebookEng",
        "brackets": {
            "cat": "_",
            "fid": 0,
            "index": 0,
            "fun": "_",
            "children": [
                {
                    "token": "the"
                }
            ]
        },
        "text": "su",
        "completions": [
            "supermarket",
            "suspect"
        ]
    }
]

With full=true or full=yes:

[
    {
        "from": "PhrasebookEng",
        "brackets": {
            "cat": "_",
            "fid": 0,
            "index": 0,
            "fun": "_",
            "children": [
                {
                    "token": "the"
                }
            ]
        },
        "text": "su",
        "completions": [
            {
                "token": "supermarket",
                "funs": [
                    {
                        "fid": 421,
                        "fun": "Supermarket",
                        "hyps": [],
                        "cat": "PlaceKind"
                    }
                ]
            },
            {
                "token": "suspect",
                "funs": [
                    {
                        "fid": 445,
                        "fun": "Suspect",
                        "hyps": [],
                        "cat": "Property"
                    }
                ]
            }
        ]
    }
]
2014-07-11 09:25:26 +00:00
kr.angelov
0222d2440c implemented computing with abstract syntax trees. It passes all test cases except those that require def rules. The design is consistent with the STG virtual machine 2014-07-08 19:45:49 +00:00
kr.angelov
e0fe6d01c4 bugfix for the typechecker in the C runtime 2014-07-08 19:19:48 +00:00
kr.angelov
ada85ae44e an API for visitor patterns on abstract syntax trees from Python. This makes the embedded grammars especially pleasing 2014-07-06 23:48:51 +00:00
kr.angelov
85672af858 small fix for the embedded mode in Python 2014-07-06 19:55:08 +00:00
kr.angelov
e52d5bf715 embedded mode for GF grammar in Python. Only generation for now 2014-07-06 19:49:17 +00:00
kr.angelov
7ad2f7dac3 filter out the leading +/* from the parser tree 2014-07-03 18:27:39 +00:00
kr.angelov
aa746ad0f6 bugfix in the ParseTreeView 2014-07-03 18:09:34 +00:00
kr.angelov
272a8487f8 scroll bars for the ParseTreeView 2014-07-03 13:42:26 +00:00
kr.angelov
e0fa954256 Visualization for parse trees on Android 2014-07-02 11:30:06 +00:00
kr.angelov
abb50f9c73 added bracketedLinearize in the Java binding 2014-07-02 07:08:01 +00:00
kr.angelov
4a7055e994 fixed rare memory leak in the Java bindings 2014-07-02 07:06:51 +00:00
kr.angelov
064cf03005 a few changes in the Nerc that I have forgoten to push 2014-07-01 17:32:25 +00:00
kr.angelov
7aa8bf4150 fix warnings in the compilation of the Java binding 2014-07-01 17:31:29 +00:00
hallgren
0715cfe2ae minibar: include the grammar's last modification in the grammar info shown by the "i" button
Also bumped version number in gf.cabal to 3.6-darcs.
Also removed some unecessary use of CPP.
2014-06-24 13:59:09 +00:00
hallgren
38f28da6c1 Polished and renamed release notes to release-3.6.t2t
Also added an example use of lookupmorpho to gf-web-api-examples.html.
2014-06-21 13:02:10 +00:00