summaryrefslogtreecommitdiff
path: root/src/compiler/GF/Compile/Compute/ConcreteNew.hs
AgeCommit message (Collapse)Author
2021-07-01Rename GF.Compile.Compute.ConcreteNew to GF.Compile.Compute.ConcreteJohn J. Camilleri
2020-11-10Deleted redundant pattern matchLiyana
2020-06-05Condense the unsupported token gluing as per John's suggestionInari Listenmaa
2020-06-04Add clarification to Unsupported token gluing (both good and bad case)Inari Listenmaa
2020-06-04Add clarification to "Pattern is not linear" error msg.Inari Listenmaa
2019-09-20more dead codekrangelov
2018-04-18Fixes for GHC 8.4.1 compatibilityThomas Hallgren
* In GHC 8.4.1, the operator <> has become a method of the Semigroup class and is exported from the Prelude. This is unfortunate, since <> is also exported from the standard library module Text.PrettyPrint, so in any module that defines a pretty printer, there is likely to be an ambiguity. This affects ~18 modules in GF. Solution: import Prelude hiding (<>) This works also in older versions of GHC, since GHC does't complain if you hide something that doesn't exists. * In GHC 8.4.1, Semigroup has become a superclass of Monoid. This means that anywhere you define an instance of the Monoid class you also have to define an instance in the Semigroup class. This affects Data.Binary.Builder in GF. Solution: conditionally define a Semigroup instance if compiling with base>=4.11 (ghc>=8.4.1)
2017-03-06GF.Compile.Compute.ConcreteNew now can handle EPattTypekrasimir
2016-03-15more progress on the typecheckerkrasimir
2016-03-07current state of the experimental typecheckerkrasimir
2016-03-03add missing cases in vapply in the partial evaluatorkrasimir
2016-03-02fix in the typecheckerkrasimir
2016-03-02a better interface between the type checker and the partial evaluatorkrasimir
2016-03-02the experimental type checker in GF.Compile.TypeCheck.ConcreteNew is now ↵krasimir
rewriten to use the complete evaluator in GF.Compile.Compute.ConcreteNew. The old sketchy implementation in GF.Compile.Compute.ConcreteNew1 is now removed.
2015-12-02GF shell, cc command: try to compute pre{...} tokens in token sequenceshallgren
This is implemented as a simple post-processing step after partial evaluation to try compute pre{...} tokens in token sequences. Nothing is done to deal with intervening free variants. This was done in response to a query from René T on the gf-dev mailing list.
2015-09-30cc -trace: don't try to show the bodies of lambda abstractionshallgren
This triggers evaluation of terms with free variables, which the partial evaluator isn't equipped to handle. Reported by Aarne.
2015-09-28Preliminary new shell feature: cc -trace.hallgren
You can now do things like cc -trace mkV "debug" to see a trace of all opers with their arguments and results during the computation of mkV "debug".
2015-08-28Comment out some dead code found with -fwarn-unused-bindshallgren
Also fixed some warnings and tightened some imports
2015-03-04GF.Compile.Compute.ConcreteNew: add dynamic table conversionhallgren
If the enumaration of table parameter values fails during the static traversal phase, try again in the dynamic computation phase, when the values of bound variables are known. This is necessary to properly deal with generic table construction in opers, like the ones found in prelude/Coordination.gf, e.g. consTable : (P : PType) -> ... = \P ... -> {s1 = table P {...} ; ... }
2015-03-04GF.Compile.Compute.ConcreteNew: some refactoring for readabilityhallgren
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-16Some work on the haddock documentationhallgren
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-05-16Compute/ConcreteNew.hs: adding a Prawitz rewritehallgren
(table { p_i => t_i } ! x).l ==> table { p_i => t_i.l } ! x This was used in the old partial evaluator and can significantly reduce term sizes in some cases.
2014-03-17show the value in the error message when failing to get Str from valueaarne
2014-02-17fix in GF.Compile.Compute.ConcreteNew which makes it possible to compile ↵kr.angelov
DocumentationBul.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.
2013-09-09partial evaluator: prettier complaint about nonlinears patternshallgren
2013-09-09partial evaluator: complain about nonlinear patternshallgren
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-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.
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