Commit Graph

41 Commits

Author SHA1 Message Date
hallgren
aa9280b287 Workaround for a problem with lock fields
This problem showed up after delaing eta expansion until just before partial
evaluation
2013-09-10 13:43:59 +00:00
hallgren
b93f817058 new-comp: delay eta expansion until just before partial evaluation
This seems to work for the most part, but a problem showed up in WordsCat.gf in
the phrasebook.
2013-05-30 16:01:12 +00:00
kr.angelov
df26b134fc fix in the GF compiler and runtime which let us to define pre construct detecting whether this is the last token. 2013-09-03 07:51:25 +00:00
kr.angelov
a20cd77d25 nonExist now does the expected thing 2013-08-23 13:17:45 +00:00
hallgren
80fe693546 Fix a problem with pattern macros in pre { } expressions
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-16 13:36:23 +00:00
hallgren
14c8da214c Fix a bug with record extension
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-29 14:59:16 +00:00
hallgren
713e883ad7 Better error message for Predef.error
+ 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-28 16:12:56 +00:00
hallgren
12dec2503d bug fix in the new partial evaluator
It can leave wildcard tables in their origial form, but it easy to handle
them in the unfactor function in GeneratePMCFG.
2012-12-20 16:41:43 +00:00
hallgren
d7e3c869c2 More work on the new partial evaluator
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-14 14:00:21 +00:00
hallgren
5e091d2e3d partial evaluator work
* 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-11 15:37:41 +00:00
hallgren
27e675910a Adding a new experimental partial evalutator
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-11-13 14:09:15 +00:00
hallgren
6fcd435cd9 GeneratePMCFG: prefix messages about "impossible" errors with 'Internal error:'
Just to make them easier to spot when wading through thousands of lines of
warnings...
2012-10-24 17:08:52 +00:00
hallgren
1195db1da3 Consistenly use SourceGrammar instead of [SourceModule] when calling compiler passes 2012-10-19 19:56:00 +00:00
peter.ljunglof
a7de16c34b Added an O(n log n) version of nub
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-08-29 21:45:10 +00:00
hallgren
47c116b5a6 Workaround for bug in ghc-7.2.2
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-03-26 23:56:56 +00:00
kr.angelov
eb4bfb008e buf fix in the compiler for HOAS 2012-02-28 08:10:47 +00:00
kr.angelov
c05be64838 now if some module is compiled with -no-pmcfg then the PMCFG code is generated at the end during the linking phase. Now the default compilation of the libraries with cabal is with -no-pmcfg. 2011-11-24 14:23:04 +00:00
kr.angelov
26d61354dd make addSequencesB(V) strict. Otherwise we get stack overflow when compiling LangFre 2011-11-22 20:31:58 +00:00
kr.angelov
416d231c5e Now PMCFG is compiled per module and at the end we only link it. The new compilation schema is few times faster. 2011-11-10 14:09:41 +00:00
kr.angelov
734c66710e merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the separate PGF building 2011-11-02 13:57:11 +00:00
krasimir
71e0ec4d41 bugfix: GeneratePMCFG should initialize the lexicon to empty 2010-12-17 09:11:04 +00:00
krasimir
84736e5712 fixed typo in GeneratePMCFG.hs. fidFloat -> fidVar 2010-10-25 11:48:17 +00:00
krasimir
fad0512c94 added missing case for GF.Compile.GeneratePMCFG.evalTerm 2010-08-30 07:54:53 +00:00
krasimir
b0e110cf4f native representation for HOAS in PMCFG and incremental type checking of the parse forest 2010-08-09 10:10:08 +00:00
krasimir
5ae7be358d redesign the open-literals API 2010-07-01 08:51:59 +00:00
krasimir
eb0bd54e68 rename isLiteralFCat -> isPredefFId, fcat(String|Int|Float) -> fid(String|Int|Float) 2010-06-30 07:40:22 +00:00
krasimir
a6b8c11905 fix the compilation of literal categories in GeneratePMCFG.hs 2010-06-22 11:29:20 +00:00
krasimir
7e9b1ebfa4 addFCoercion -> addCoercion in GeneratePMCFG 2010-06-20 08:53:25 +00:00
krasimir
9995a834ae getFCats -> getFIds in GeneratePMCFG 2010-06-20 08:45:31 +00:00
krasimir
a77815e35a removed debugging code in GeneratePMCFG.hs 2010-06-20 08:30:00 +00:00
krasimir
992a7ffb38 Yay!! Direct generation of PMCFG from GF grammar 2010-06-18 12:55:58 +00:00
krasimir
6eda1118fc since now we don't do common subexpression elimination for PGF we could simplify the PMCFG generation 2010-05-26 09:37:32 +00:00
krasimir
2544ea8c8a in verbose mode print the rule names when compiling PMCFG 2010-02-06 18:24:15 +00:00
krasimir
890d455793 cleanup the code of the PGF interpreter and polish the binary serialization to match the preliminary specification 2010-01-27 09:39:14 +00:00
krasimir
9b362ff231 PGF is now real synchronous PMCFG 2010-01-17 21:35:36 +00:00
krasimir
af13bae2df now the linearization is completely based on PMCFG 2010-01-17 17:05:21 +00:00
krasimir
389b55103c small code cleanup in GeneratePMCFG.hs 2010-01-16 22:10:45 +00:00
krasimir
cf22bd094f move the definitions of _B and _V to PGF.Macros 2010-01-12 14:36:41 +00:00
krasimir
ee3ce9694c store the label names in PMCFG 2010-01-05 08:35:33 +00:00
krasimir
c036459214 remove the old parsing code and the -erasing=on flag 2009-12-14 10:54:22 +00:00
krasimir
f85232947e reorganize the directories under src, and rescue the JavaScript interpreter from deprecated 2009-12-13 18:50:29 +00:00