summaryrefslogtreecommitdiff
path: root/src/compiler
AgeCommit message (Collapse)Author
2014-08-13Fix warnings in 16 modules, mostly forward compatibility warnings from GHC 7.8hallgren
2014-08-13Refactoring in GF.Compile and GF.ReadFiles with an eye to parallel compilationhallgren
In particular, the function compileOne has been moved to the new module GF.CompileOne and its type has been changed from compileOne :: ... -> CompileEnv -> FilePath -> IOE CompileEnv to compileOne :: ... -> SourceGrammar -> FilePath -> IOE OneCompiledModule making it more suitable for use in a parallel compiler.
2014-08-11GF.Compile: remove the Int from CompileEnvhallgren
It has been unused since the refresh pass was removed. This eliminates one obstacle to parallel module compilation.
2014-08-11pattern matching in def rules is now supportedkr.angelov
2014-08-11revert an accidental change that I pushed together with the last patchkr.angelov
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-07-28Convert from Text.PrettyPrint to GF.Text.Prettyhallgren
All compiler modules now use GF.Text.Pretty instead of Text.PrettyPrint
2014-07-27Adding GF.Infra.Location and GF.Text.Pretty (forgot to 'darcs add' them before)hallgren
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-24minibar: include the grammar's last modification in the grammar info shown ↵hallgren
by the "i" button Also bumped version number in gf.cabal to 3.6-darcs. Also removed some unecessary use of CPP.
2014-06-21The --output-dir option now applies also to PGF fileshallgren
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-06-12now GF keywords can be used as identifiers if they are quotedkr.angelov
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-05-21in verbosity mode the compiler warns about missing pathskr.angelov
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-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-05-12gf -server: include list of loaded PGFs in version infohallgren
2014-04-28Spring cleaninghallgren
Nothing major...
2014-04-09PGF web service: add unlexers and enable client side cachinghallgren
Most PGF web API commands that produce linearizations now accept an unlexer parameter. Possible values are "text", "code" and "mixed". The web service now include Date and Last-Modified headers in the HTTP, responses. This means that browsers can treat responses as static content and cache them, so it becomes less critical to cache parse results in the server. Also did some cleanup in PGFService.hs, e.g. removed a couple of functions that can now be imported from PGF.Lexing instead.
2014-04-09Change the type of PGF.Lexing.bindTok to [String] -> [String]hallgren
The old type was [String] -> String. This function was only used in GF.Text.Lexing.stringOp, which now uses (unwords . bindTok) instead, with no change in behaviour.
2014-04-09Unlexers: move capitalization of first word from GF.Text.Lexing to PGF.Lexinghallgren
The capitalization of the first word was done in GF.Text.Lexing.stringOp, but is now done in the functions unlexText and unlexMixed in PGF.Lexing. These functions are only used in stringOp and in PGFService (where the change is needed), so the subtle change in behaviour should not cause any bugs.
2014-04-08Move basic lexing functions from GF.Text.Lexing to the new module PGF.Lexinghallgren
They are thus part of the PGF Run-Time Library, making it possible to add lexing functionality in PGF service in a natural way.
2014-04-04TypeCheck.RConcrete: contravariance in table typeshallgren
2014-04-04Removed imports of TypeCheck.Concrete, fixed problems in TypeCheck.RConcretehallgren
+ The current type checker for concrete syntax is in GF.Compile.TypeCheck.RConcrete, but GF.Compile.TypeCheck.Concrete was still imported in GFI. + Fixed a bug that allowed Ints n as a subtype of Ints m, regardless of m and n. It now requires n<=m. Note: the type checker still allows Int as a subtype of Ints m, regardless of m. + Fixed a potential efficiency problem with large record types, by reducing the number of recursive calls from |R|*|S| to |R| when checking if R<=S. + Fixed a misleading comment: "alpha g t u" checks that u is a subtype of t, the other way around. Similarly, "checkIfEqLType gr g t u trm" checks that u is a subtype of t, not the other way around, and not that t is equal to u.
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.
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-03-19gf -server: add a command to manually flush the PGF cachehallgren
This can be used if the cloud service seems slow, but it would probably be better to automatically expire unused PGFs from the cache after some time.
2014-03-17show the value in the error message when failing to get Str from valueaarne
2014-03-15bugfix in the compiler for linref of empty recordkr.angelov
2014-02-17fix in GF.Compile.Compute.ConcreteNew which makes it possible to compile ↵kr.angelov
DocumentationBul.gf
2014-02-11GFServer.hs: avoid intertwined log messages from parallel requestshallgren
2014-02-09disabled ad hoc overloading, as it still causes mysterious errors. It is ↵aarne
just a few lines in Rename.hs
2014-02-04GFC.hs: encodeFile_ is not available in the standard Data.Binaryhallgren
2014-02-01new overload resolution, taking care of ad hoc overloading.aarne
2014-02-01ad hoc overloading: a new way to deal with name resolution conflicts. ↵aarne
Previously the renamer warned if there was e.g. an unqualified reference to mkAdv, which could come from either Syntax or Paradigms. The renamer picked randomly one of the alternatives, which then often failed in type checking. Now, all candidates are collected into a new structure AdHocOverload [Term], which is accessed by the type checker to make the choice based on the type of the constant. This eliminates some of the warnings and some of the error due to wrong choices. In some rare cases, the inherited constants have the same type, which cannot be resolved by overloading. In such cases, the type checker does the same as the renamer did before: pick the "first" option (i.e. the one that happens to be the first in the list returned by the renamer) and issues a warning. In this patch, only a couple of lines are changed. The typechecker (RConcrete) has more substantial changes, and will be recorded as the next patch.
2014-01-31typo in Concrete type checker: when type checking <e : t>, return annotated ↵aarne
e and not e itself. Fixed in RConcrete, which should soon replace Concrete; and hopefully will be replaced by some cleaner code soon, such as ConcreteNew which has been under construction for quite some time.
2014-01-31experimental type checker module GF.Compile.TypeCheck.RConcrete.hs with ↵aarne
record updates enabled by ** expressions. Can be changed back to Concrete.hs by just changing one import command in GF.Compile.CheckGrammar.hs. The worst thing that *should* happen with the new type checker is that some old code is detected to be invalid, which happens if it contains a type-incompatible record extension, e.g. {x = "foo"} ** {x = 1}. Previously such errors were silently ignored. A set of test runs detected one such error in the RGL, which was corrected. On the positive side, the new type checker now enables record updates in the natural way: R ** {x = 1} will give value x = 1 overshadowing any value of x in R (provided the expected type of x is Int). lib/src/experimental/PredicationSwe.gf illustrates this, as opposed to PredicationSwO.gf which has to use old-style copying of even the unchanged record fields.
2014-01-27gf -server: fix a redirection bug...hallgren
...that was introduced with the recent changes to the handling of the current working directory
2014-01-24gf -server: allow multiple PGF service requests to be handled in parallelhallgren
PGF service requests are stateless and can run in parallel, but some other requests handled by the server are not and might even change the current working directory temporarily, and this affects all threads, so it is important that the PGF service requests access PGF files by absolute paths.
2014-01-20Optionally include C run-time supporthallgren
If the C run-time library is compiled and installed on your system, you can now do 'cabal configure -fc-runtime' to get the following extras: + The haskell binding to the C run-time library will be included in the PGF library (so you can import it in Haskell applications). Documentation on the new modules will be included when you run 'cabal haddock'. + The new command 'pgf-shell', implemented on top of haskell binding to the C run-time system. + Three new commands in the web API: c-parse, c-linearize and c-translate. Their interfaces are similar to the corresponding commands without the "c-" prefix, but they should be considered preliminary.
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-18PGFtoPython: add Python translations for nonExist, BIND and SOFT_BINDhallgren
Someone who is familiar with the Python translation should check this.
2013-12-16GF.Compile.ReadFiles: reduced code duplicationhallgren
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-12-06Show relative file paths in error messageshallgren
This is to avoid one trivial reason for failures in the test suite.
2013-12-06GF.Compile.CheckGrammar: add source path to error message for circular ↵hallgren
definitions