summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/GeneratePMCFG.hs
AgeCommit message (Collapse)Author
2015-05-11added all orthographic primitiveskrasimir
2015-03-05removed some operations in GeneratePMCFG. They didn't work well with ↵krasimir
variants and are now obsolete with the new partial evaluator
2015-02-20added option -plus-as-bind which treats (+) as a bind when used with runtime ↵krasimir
variables
2014-12-05Eliminate the record extension operator from the Value type returned by the ↵hallgren
partial evaluator It was used only in cases where a lock field needed to be added to a run-time variable, like e.g. in examples/phrasebook/SentencesTha.gf: lin PGreetingMale g = mkText (lin Text g) (lin Text (ss "ครับ")) | g ; PGreetingFemale g = mkText (lin Text g) (lin Text (ss "ค่ะ")) | g ; But lock fields are only meaningful during type checking and can safely be ignored in later passes.
2014-10-21ModuleName and Ident are now distinct typeshallgren
This makes the documentation clearer, and can potentially catch more programming mistakes.
2014-10-09Prelude.CAPIT is now a built-in primitive. It still generates &| in the ↵kr.angelov
Haskell runtime but will be intepreted in the C runtime
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-07-27Introducing GF.Text.Pretty for more concise pretty printers and ↵hallgren
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-06-17Compute/ConcreteNew.hs: eliminate selections from wildcard tableshallgren
This patch also includes some commented out code that was used to search for the source of code size explosions and an eta expansion bug.
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-16Fix an eta expansion bug in the grammar compilerhallgren
Eta expansion is applied between partial evaluation and PMCFG generation. The buggy version generated type incorrect terms, but PMCFG generation apparently worked anyway.
2014-04-01Bug fix for pattern macros in pre{}hallgren
This bug was introduced sometime between 2013-08-21 and 2013-11-01 and caused the function convertTerm in GF.Compile.GeneratePMCFG to encounter a EPatt where it expected Strs. I fixed it by applying the function getPatts (from the old partial evaluator) to the pattern.
2013-11-29Commment code and options relating to the old partial evaluatorhallgren
This means that the -old-comp and -new-comp flags are not recognized anymore. The only functional difference is that printnames were still normalized with the old partial evaluator. Now that is done with the new partial evaluator.
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-12added Predef.SOFT_BIND. This special token allows zero or more spaces ↵kr.angelov
between ordinary tokens. It is also used in the English RGL to attach the commas to the previous word.
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-10-30added the linref construction in GF. The PGF version number is now bumpedkr.angelov
2013-09-27a major refactoring in the C and the Haskell runtimes. Note incompatible ↵kr.angelov
change in the PGF format!!! The following are the outcomes: - Predef.nonExist is fully supported by both the Haskell and the C runtimes - Predef.BIND is now an internal compiler defined token. For now it behaves just as usual for the Haskell runtime, i.e. it generates &+. However, the special treatment will let us to handle it properly in the C runtime. - This required a major change in the PGF format since both nonExist and BIND may appear inside 'pre' and this was not supported before.
2013-09-23fix a warning in the compilerkr.angelov
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.
2013-09-10Some code verbosity reductionhallgren
2013-09-10Workaround for a problem with lock fieldshallgren
This problem showed up after delaing eta expansion until just before partial evaluation
2013-05-30new-comp: delay eta expansion until just before partial evaluationhallgren
This seems to work for the most part, but a problem showed up in WordsCat.gf in the phrasebook.
2013-09-03fix in the GF compiler and runtime which let us to define pre construct ↵kr.angelov
detecting whether this is the last token.
2013-08-23nonExist now does the expected thingkr.angelov
2013-03-16Fix a problem with pattern macros in pre { } expressionshallgren
The old partial evaluator has special rules to convert pattern macros in pre { } expressions. These rules were missing in the new partial evaluator.
2013-01-29Fix a bug with record extensionhallgren
Add a conversion rule for ({ l1 = e } ** x).l2 in PMCFG generation. (A rule for the symmetric case (x ** { l1 = e }).l2 was added some time ago.)
2013-01-28Better error message for Predef.errorhallgren
+ Instead of "Internal error in ...", you now get a proper error message with a source location and a function name. + Also added some missing error value propagation in the partial evaluator. + Also some other minor cleanup and error handling fixes.
2012-12-20bug fix in the new partial evaluatorhallgren
It can leave wildcard tables in their origial form, but it easy to handle them in the unfactor function in GeneratePMCFG.
2012-12-14More work on the new partial evaluatorhallgren
The work done by the partial evaluator is now divied in two stages: - A static "term traversal" stage that happens only once per term and uses only statically known information. In particular, the values of lambda bound variables are unknown during this stage. Some tables are transformed to reduce the cost of pattern matching. - A dynamic "function application" stage, where function bodies can be evaluated repeatedly with different arguments, without the term traversal overhead and without recomputing statically known information. Also the treatment of predefined functions has been reworked to take advantage of the staging and better handle partial applications.
2012-12-11partial evaluator workhallgren
* Evaluate operators once, not every time they are looked up * Remember the list of parameter values instead of recomputing it from the pattern type every time a table selection is made. * Quick fix for partial application of some predefined functions.
2012-11-13Adding a new experimental partial evalutatorhallgren
GF.Compile.Compute.ConcreteNew + two new modules contain a new partial evaluator intended to solve some performance problems with the old partial evalutator in GF.Compile.Compute.ConcreteLazy. It has been around for a while, but is now complete enough to compile the RGL and the Phrasebook. The old partial evaluator is still used by default. The new one can be activated in two ways: - by using the command line option -new-comp when invoking GF. - by using cabal configure -fnew-comp to make -new-comp the default. In this case you can also use the command line option -old-comp to revert to the old partial evaluator. In the GF shell, the cc command uses the old evaluator regardless of -new-comp for now, but you can use "cc -new ..." to invoke the new evaluator. With -new-comp, computations happen in GF.Compile.GeneratePMCFG instead of GF.Compile.Optimize. This is implemented by testing the flag optNewComp in both modules, to omit calls to the old partial evaluator from GF.Compile.Optimize and add calls to the new partial evaluator in GF.Compile.GeneratePMCFG. This also means that -new-comp effectively implies -noexpand. In GF.Compile.CheckGrammar, there is a check that restricted inheritance is used correctly. However, when -noexpand is used, this check causes unexpected errors, so it has been converted to generate warnings, for now. -new-comp no longer enables the new type checker in GF.Compile.Typeckeck.ConcreteNew. The GF version number has been bumped to 3.3.10-darcs
2012-10-24GeneratePMCFG: prefix messages about "impossible" errors with 'Internal error:'hallgren
Just to make them easier to spot when wading through thousands of lines of warnings...
2012-10-19Consistenly use SourceGrammar instead of [SourceModule] when calling ↵hallgren
compiler passes
2012-08-29Added an O(n log n) version of nubpeter.ljunglof
The new nub is called nub', and it replaces the old sortNub which was not lazy and did not retain the order between the elements.
2012-03-26Workaround for bug in ghc-7.2.2hallgren
An apparent bug in ghc-7.2.2 causes the type Value to be exported from PGF.Data. Workaround: restrict the imports from PGF.Data in GF.Command.Abstract and GF.Compile.GeneratePMCFG to avoid the clash with locally defined type Value. (ghc-7.0.4 and ghc-7.4.1 appear to be free from this bug.)
2012-02-28buf fix in the compiler for HOASkr.angelov
2011-11-24now if some module is compiled with -no-pmcfg then the PMCFG code is ↵kr.angelov
generated at the end during the linking phase. Now the default compilation of the libraries with cabal is with -no-pmcfg.
2011-11-22make addSequencesB(V) strict. Otherwise we get stack overflow when compiling ↵kr.angelov
LangFre
2011-11-10Now PMCFG is compiled per module and at the end we only link it. The new ↵kr.angelov
compilation schema is few times faster.
2011-11-02merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the ↵kr.angelov
separate PGF building
2010-12-17bugfix: GeneratePMCFG should initialize the lexicon to emptykrasimir
2010-10-25fixed typo in GeneratePMCFG.hs. fidFloat -> fidVarkrasimir
2010-08-30added missing case for GF.Compile.GeneratePMCFG.evalTermkrasimir
2010-08-09native representation for HOAS in PMCFG and incremental type checking of the ↵krasimir
parse forest
2010-07-01redesign the open-literals APIkrasimir
2010-06-30rename isLiteralFCat -> isPredefFId, fcat(String|Int|Float) -> ↵krasimir
fid(String|Int|Float)
2010-06-22fix the compilation of literal categories in GeneratePMCFG.hskrasimir
2010-06-20addFCoercion -> addCoercion in GeneratePMCFGkrasimir