summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/Compute
AgeCommit message (Collapse)Author
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-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-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-09partial evaluator: prettier complaint about nonlinears patternshallgren
2013-09-09partial evaluator: complain about nonlinear patternshallgren
2013-09-09Fix an old name shadowing bug in concrete syntax by removing the refresh passhallgren
The refresh pass does not correctly keep track of the scope of local variables and can convert things like \x->(\x->x) x into \x1->(\x2->x2) x2. Fortunately, it appears that the refresh pass is not needed anymore, so it has been removed.
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-03-12partial evaluator: push predefined functions inside variantshallgren
This should prevent errors like Internal error in Compute.ConcreteNew: Applying Predef.drop: Expected a value of type String, got VFV [VString "gewandt",VString "gewendet"]
2013-02-27Faster regular expression pattern matching in the grammar compiler.hallgren
The sequence operator (x+y) was implemented by splitting the string to be matched at all positions and trying to match the parts against the two subpatterns. To reduce the number of splits, we now estimate the minimum and maximum length of the string that the subpatterns could match. For common cases, where one of the subpatterns is a string of known length, like in (x+"y") or (x + ("a"|"o"|"u"|"e")+"y"), only one split will be tried.
2013-01-29Better error message for unsupported token gluinghallgren
Instead of "Internal error in ...", you now get a proper error message with a source location and a function name.
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.
2013-01-11partial evaluator: fix token glueing bughallgren
"a"+("b"++"c") was simplified to "bb"++"c" instead of "ab"++c.
2012-12-19partial evaluator bug fixhallgren
It failed to delay table selection when the selector contains a run-time variable, causing "gf: Prelude.(!!): index too large" instead. Also: + Show better source locations on unexpected errors, to aid bug hunting. + Removed unused SourceGrammar argument to value2term.
2012-12-19GF.Grammar.Lookup: new function lookupResDefLochallgren
It's like lookupResDef but it includes a source location in the output.
2012-12-18partial evaluator bug fixhallgren
Int was missing from the list of predefined canonical constants.
2012-12-14Add language extension for ghc<7.4hallgren
FlexibleInstances does not imply TypeSynonymInstances, apparently.
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-12-10Compute.ConcreteNew: add missing case for variant functionshallgren
Also adding a test case in the test suite for this.
2012-12-06Compute.ConcreteNew: bug fix for indirectly defined pattern macroshallgren
More changes are probably needed to make pattern macros first class values. Also includes minor changes related to variants and error messages.
2012-11-16new-comp: rewrite f (x|y) into (f x|f y)hallgren
With this change, all languages in molto/mgl/mixture except German and Polish can be compiled.
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-24Compute.ConcreteNew: support variantshallgren
Also add a missing check for Predef values in apply.
2012-05-15missing case in partial evaluation of + fixedaarne
2012-02-28bug fix in AppPredefined: don't compare values that contain variables. this ↵aarne
should be checked even more generally.
2012-02-24the Predef function eqVal to compare equality of parameter valuesaarne
2011-12-02The typechecker is still unfinished but at least it can typecheck the ↵kr.angelov
English resource grammar
2011-11-30Hopefully complete Value type and a little bit more on computations.kr.angelov
2011-11-30more stuff in the new type checkerkr.angelov
2011-11-29Sketch of the new type checker for the concrete syntax. Enabled only with ↵kr.angelov
-new-comp
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
2011-11-02Now the compiler maintains more precise information for the source locations ↵kr.angelov
of the different definitions. There is a --tags option which generates a list of all identifiers with their source locations.
2011-11-01Remove configuration flag cclazyhallgren
2011-10-25Recording an alternative version of look in Compute/ConcreteLazy.hshallgren
Commented out, causes problems in the greek example.
2011-10-24use associativity to force more precompilation of pre expressionsaarne
2011-10-20Introduce an explicit error value in the Term typehallgren
This makes it easier to treat run-time errors (e.g. caused by calls to Predef.error) in a way that is more typical for a lazy functional language.
2011-10-20Compute/ConcreteLazy.hs: no need to reverse when looking up labels in recordshallgren
2011-10-20AppPredefined.hs: more readable notation for the types of primitiveshallgren
2011-09-09Remove unused function computeConcreteRec.hallgren
This also allows the parameter rec to be removed from function computeTermOpt. (The change is made in GF.Compile.Compute.ConcreteLazy, but not in GF.Compile.Compute.ConcreteStrict.)
2011-09-01Add lazy version of GF.Compile.Compute.Concretehallgren
This patch adds GF.Compile.Compute.ConcreteLazy, which replaces the Err monad with the Identity monad. While the Err monad makes the interpreter (hyper)strict, the Identity monad let's the interpreter inherit Haskell's laziness. This can give big speedups: from 50s to 1s in one example, from ~4 minutes to ~2 minutes for the RGL. This is still experimental and might be buggy, so it is off by default. You can turn it on by configuring with the -fcclazy flag, e.g. cabal configure -fcclazy Let me know if anything breaks.
2011-08-25reload command in shellaarne
2011-08-22commented Compute/Concrete with explanationsaarne
2011-06-02Predef functions toUpper, toLower, isUpperaarne
2011-02-25Predef.error surfaces as error message in compilation and cc commandaarne
2010-12-11fixed the failure to partial-evaluate pre in right-associative contextaarne
2010-07-01the abstract syntax for Predef.gf is now hard-coded in AppPredefined.hskrasimir
2010-07-01reorganize the modules in GF.Compile.*krasimir