summaryrefslogtreecommitdiff
path: root/src/compiler/GFC.hs
AgeCommit message (Collapse)Author
2014-10-15Rename modules GFI, GFC & GFServer...hallgren
... to GF.Interactive, GF.Compiler & GF.Server, respectively.
2014-09-08(1) Refactor concurrency, (2) write to .gfo.tmp then rename to .gfohallgren
(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-08-25Experimental: parallel batch compilation of grammarshallgren
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-13Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8hallgren
2014-08-11a partial support for def rules in the C runtimekr.angelov
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-06-21The --output-dir option now applies also to PGF fileshallgren
2014-06-12PGF library: expose only PGF and PGF.Internal instead of all moduleshallgren
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-05-24now we compile context-free grammars directly to PGF without going via GF ↵kr.angelov
source code. This makes it quick and lightweight to compile big grammars such as the Berkley grammar
2014-03-21refactor the compilation of CFG and EBNF grammars. Now they are parsed by ↵kr.angelov
using GF.Grammar.Parser just like the ordinary GF grammars. Furthermore now GF.Speech.CFG is moved to GF.Grammar.CFG. The new module is used by both the speech conversion utils and by the compiler for CFG grammars. The parser for CFG now consumes a lot less memory and can be used with grammars with more than 4 000 000 productions.
2014-02-04GFC.hs: encodeFile_ is not available in the standard Data.Binaryhallgren
2014-01-09Check file datestamp before creating PGF file when compiling grammarshallgren
When running a command like gf -make L_1.gf ... L_n.gf gf now avoids recreating the target PGF file if it already exists and is up-to-date. gf still reads all required .gfo files, so significant additional speed improvements are still possible. This could be done by reading .gfo files more lazily...
2014-01-09Check file datestamps before unioning PGF files (fix)hallgren
Also check that no additional output formats have been selected.
2014-01-09Check file datestamps before unioning PGF fileshallgren
When running a command like gf -make -name=T L_1.pgf ... L_n.pgf gf now checks if T.pgf exists and is up-to-date before reading and computing the union of the L_i.pgf files. The name (T) of the target PGF file has to be given explicitly for this to work, since otherwise the name is not known until the union has been computed. If the functions for reading PGF files and computing the union were lazier, this would not be necessary...
2013-12-10option --split-pgf replaces option --mk-index. This splits the PGF into one ↵kr.angelov
file for the abstract and one more for each concrete syntax. This is a preparation for being able to load only specific languages from the whole grammar.
2013-11-25Change how GF deals with character encodings in grammar fileshallgren
1. The default encoding is changed from Latin-1 to UTF-8. 2. Alternate encodings should be specified as "--# -coding=enc", the old "flags coding=enc" declarations have no effect but are still checked for consistency. 3. A transitional warning is generated for files that contain non-ASCII characters without specifying a character encoding: "Warning: default encoding has changed from Latin-1 to UTF-8" 4. Conversion to Unicode is now done *before* lexing. This makes it possible to allow arbitrary Unicode characters in identifiers. But identifiers are still stored as ByteStrings, so they are limited to Latin-1 characters for now. 5. Lexer.hs is no longer part of the repository. We now generate the lexer from Lexer.x with alex>=3. Some workarounds for bugs in alex-3.0 were needed. These bugs might already be fixed in newer versions of alex, but we should be compatible with what is shipped in the Haskell Platform.
2013-11-20Reduced clutter in monadic codehallgren
+ Eliminated vairous ad-hoc coersion functions between specific monads (IO, Err, IOE, Check) in favor of more general lifting functions (liftIO, liftErr). + Generalized many basic monadic operations from specific monads to arbitrary monads in the appropriate class (MonadIO and/or ErrorMonad), thereby completely eliminating the need for lifting functions in lots of places. This can be considered a small step forward towards a cleaner compiler API and more malleable compiler code in general.
2013-11-06the content of ParseEngAbs3.probs is now merged with ParseEngAbs.probs. The ↵kr.angelov
later is now retrained. Once the grammar is compiled with the .probs file now it doesn't need anything more to do robust parsing. The robustness itself is controlled by the flags 'heuristic_search_factor', 'meta_prob' and 'meta_token_prob' in ParseEngAbs.gf
2013-11-05Eliminate mutual dependencies between the GF compiler and the PGF libraryhallgren
+ References to modules under src/compiler have been eliminated from the PGF library (under src/runtime/haskell). Only two functions had to be moved (from GF.Data.Utilities to PGF.Utilities) to make this possible, other apparent dependencies turned out to be vacuous. + In gf.cabal, the GF executable no longer directly depends on the PGF library source directory, but only on the exposed library modules. This means that there is less duplication in gf.cabal and that the 30 modules in the PGF library will no longer be compiled twice while building GF. To make this possible, additional PGF library modules have been exposed, even though they should probably be considered for internal use only. They could be collected in a PGF.Internal module, or marked as "unstable", to make this explicit. + Also, by using the -fwarn-unused-imports flag, ~220 redundant imports were found and removed, reducing the total number of imports by ~15%.
2013-09-19Make Ident abstract; imports of Data.ByteString.Char8 down from 29 to 16 moduleshallgren
Most of the explicit uses of ByteStrings were eliminated by using identS, identS = identC . BS.pack which was found in GF.Grammar.CF and moved to GF.Infra.Ident. The function prefixIdent :: String -> Ident -> Ident allowed one additional import of ByteString to be eliminated. The functions isArgIdent :: Ident -> Bool getArgIndex :: Ident -> Maybe Int were needed to eliminate explicit pattern matching on Ident from two modules.
2012-10-23cleanuphallgren
Simplify the implementation of writeUTF8File and use it in one more place. Remove unused imports left over after a previous change.
2012-08-29A basic infrastructure for generating Teyjus bytecode from the GF abstract ↵kr.angelov
syntax
2011-11-15more structured format for errors and warnings from the compilerkr.angelov
2010-12-11Adding an option to the gf compiler to add an index to pgf filesgdetrez
This is gonna be used by the android library to skip unused part of a pgf file
2010-12-07shell command pg -pgf writes current pgf into a fileaarne
2010-06-18Yay!! Direct generation of PMCFG from GF grammarkrasimir
2010-06-09dead code elimination for PGF. Note: the produced grammars will not work ↵krasimir
well with metavariables and high-order abstract syntax
2010-04-19use the native unicode support from GHC 6.12krasimir
2009-12-13reorganize the directories under src, and rescue the JavaScript interpreter ↵krasimir
from deprecated