summaryrefslogtreecommitdiff
path: root/src/compiler
AgeCommit message (Collapse)Author
2013-01-12gf -server: small logging improvementshallgren
2013-01-12gf -server: defend against problems with the current directory caused ↵hallgren
unhandled errors
2013-01-11partial evaluator: fix token glueing bughallgren
"a"+("b"++"c") was simplified to "bb"++"c" instead of "ab"++c.
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-20added alltenses to the default search path (just like prelude)aarne
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-14The first prototype for exhaustive generation in the C runtime. The trees ↵kr.angelov
are always listed in decreasing probability order. There is also an API for generation from Python
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-07Make -new-comp the default and bump the version number to 3.3.11-darcshallgren
* -new-comp (the new partial evaluator) is now chosen by default when you run cabal install (or cabal configure). To revert to using the old partial evaluator by default, use "cabal install -f-new-comp" (or "cabal configure -f-new-comp"). * Regardless of the configured default, you can choose which partial evaluator to use when you invoke gf by using the -new-comp or -old-comp command line option. * The cc command in the GF shell uses the chosen partial evaluator by default, but you can override this by using "cc -new" or "cc -old". The plan is that these flags will be romeved in a future version.
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-12-02produce error message instead of failure of irrefutable pattern Ok ty_C in ↵aarne
GrammarToPGF, to help find compilation errors; the ones I've found are because an inherited abstract excludes something that the inherited concrete does not exclude.
2012-11-23gf -server + gfse: show modification time of public grammarshallgren
2012-11-23gf -server: support overloaded opers in gfsehallgren
2012-11-23Fix a prededence bug in GF grammar pretty printerhallgren
The pretty printer produced mkDet pre {"a"; "an" / vowel} Sg which is not accepted by the parser. The parser assigns pre { ... }, to prededence level 4, and this is now reflected in the pretty printer, so it prints mkDet (pre {"a"; "an" / vowel}) Sg (This caused a problem in GFSE since it parsers pretty printed grammars...)
2012-11-22better visualization of parse treespeter.ljunglof
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-14Add flag --document-root for user with gf --serverhallgren
This can make it easier to test cloud service updates before installing them.
2012-11-14GF usage message fixeshallgren
Change the command name from gfc to gf in the usage message header. Correct spelling of "overide" to "override" in -gf-lib-path description.
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-11-08Eliminate warnings about deprecated use of catch and tryhallgren
This is also needed for compatibility with GHC 7.6.
2012-11-07GF.Grammar.PatternMatch: relax overly restrictive type signatureshallgren
2012-11-07Some changed/new utility functionshallgren
GF.Data.Utilities: Rename mapFst to apFst, mapSnd to apSnd. Add apBoth, mapFst, mapSnd, mapBoth. GF.Data.Operations: Remove onSnd (same as apSnd)
2012-11-06gf -server: make it possible to pass arbitrary flags/options to gf when ↵hallgren
compiling grammars For example, you can add -optimize-pgf: http://localhost:41296/cloud?dir=...&command=remake&-optimize-pgf=&Foods2Eng.gf=&Foods2Swe.gf=
2012-11-05unicode4k-changedvirk.shafqat
2012-10-25GF.Grammar.Macros: add function collectPattOphallgren
collectPattOp :: (Patt -> [a]) -> Patt -> [a]
2012-10-24GF.Grammar.Macros: add function composPattOphallgren
For Patt, analogous to composOp for Term.
2012-10-24Compute.ConcreteNew: support variantshallgren
Also add a missing check for Predef values in apply.
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-23gf -server: introduce command=remake for recompiling previously uploaded ↵hallgren
grammars Also remove some old commented out code.
2012-10-23cleanuphallgren
Simplify the implementation of writeUTF8File and use it in one more place. Remove unused imports left over after a previous change.
2012-10-19Refactor compileSourceModulehallgren
There was 55 lines of rather repetitive code with calls to 6 compiler passes. They have been replaced with 19 lines that call the 6 compiler passes plus 26 lines of helper functions.
2012-10-19Consistenly use SourceGrammar instead of [SourceModule] when calling ↵hallgren
compiler passes
2012-10-18Use NOINLINE for build info and darcs version infohallgren
... to avoid unnecessary recompilation of other modules.
2012-10-16GF.Command.Command: turn CommandOutput into a newtypehallgren
The output from commands is represented as ([Expr],String), where the [Expr] is used when data is piped between commands and the String is used for the final output. The String can represent the same list of trees as the [Expr] and/or contain diagnostic information. Sometimes the data that is piped between commands is not a list of trees, but e.g. a string or a list of strings. In those cases, functions like fromStrings and toStrings are used to encode the data as a [Expr]. This patch introduces a newtype for CommandOutput and collects the functions dealing with command output in one place to make it clearer what is going on. It also makes it easier to change to a more direct representation of piped data, and make pipes more "type safe", if desired.
2012-10-09gf -server: /parse command now supports input with character codes > 255hallgren
This enables the use of arbitrary Unicode character in text mode in GFSE.
2012-10-05Factor out code for setting the console encodinghallgren
Moved similar low-level code blocks in Main and GFI for setting the console encoding to the new module GF.System.Console.
2012-10-03gfse: some refactoringhallgren
2012-09-28GF shell, show_operations: nicer looking types for linearization functionshallgren
Adding a lock field to the result type of linearization functions. TODO: figure out how to add a lock field to the argument types too.
2012-09-27GF shell, show_operations: also show the types of linearization functionshallgren
This is a simple change in GF.Grammar.Lookup.allOpers, which is used only in the implementation of the show_operations command in the shell. This is useful when importing a concrete syntax (like LexiconEng) as a resource. However, the types don't always look as nice as I hoped...
2012-09-26SIO bug fixhallgren
Line breaks were missing when capturing stdout. (putStrLn acted like putStr.)
2012-09-26gf -server: add a GF version info requesthallgren
GF version info can now be obtained from http://localhost:41926/version Also removed some unused imports.
2012-09-25Use the SIO monad in the GF shellhallgren
+ The restrictions on arbitrary IO when GF is running in restricted mode is now enforced in the types. + This hopefully also solves an intermittent problem when accessing the GF shell through the web API provided by gf -server. This was visible in the Simple Translation Tool and probably caused by some low-level bug in the GHC IO libraries.
2012-09-25GF.Infra.SIO.hs: adding the SIO monad (where S = Shell or Safe)hallgren
The SIO monad is a restriction of the IO monad with two purposes: + Access to arbitrary IO operations can be turned off by setting the environment variable GF_RESTRICTED. There is a limited set of IO operations that are considered safe and always allowed. + It allows output to stdout to be captured. This can be used in gf -server mode, where output of GF shell commands is made part of HTTP responses returned to clients.
2012-09-25GF.Command.Commands: allCommands is now a constanthallgren
The dependency on PGFEnv has been moved from the list to the exec function of the commands in the list. This means that the help command no longer needs to generate a new list of commands and that the state of the shell (type GF.Command.Interpreter.CommandEnv) no longer needs to contain the list of commands.
2012-09-22GFServer.hs: code improvementshallgren
Use a monad in the request handler to make the code a bit more modular and readable.