summaryrefslogtreecommitdiff
path: root/src/compiler/GFI.hs
AgeCommit message (Collapse)Author
2014-10-15Rename modules GFI, GFC & GFServer...hallgren
... to GF.Interactive, GF.Compiler & GF.Server, respectively.
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-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-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.
2013-11-29Commment code and options relating to the old partial evaluatorhallgren
This means that the -old-comp and -new-comp flags are not recognized anymore. The only functional difference is that printnames were still normalized with the old partial evaluator. Now that is done with the new partial evaluator.
2013-11-29Move checkPredefError from GF.Compile.Compute.ConcreteLazy to GF.Grammar.Macroshallgren
Also simplified its type.
2013-11-28GFI: adapt to character encoding changeshallgren
GF.Compile.Coding is not used any more.
2013-11-20Reduced clutter in monadic codehallgren
+ Eliminated vairous ad-hoc coersion functions between specific monads (IO, Err, IOE, Check) in favor of more general lifting functions (liftIO, liftErr). + Generalized many basic monadic operations from specific monads to arbitrary monads in the appropriate class (MonadIO and/or ErrorMonad), thereby completely eliminating the need for lifting functions in lots of places. This can be considered a small step forward towards a cleaner compiler API and more malleable compiler code in general.
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-19Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remainhallgren
The fact that identifiers are represented as ByteStrings is now an internal implentation detail in module GF.Infra.Ident. Conversion between ByteString and identifiers is only needed in the lexer and the Binary instances.
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.
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-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-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-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-23cleanuphallgren
Simplify the implementation of writeUTF8File and use it in one more place. Remove unused imports left over after a previous change.
2012-10-18Use NOINLINE for build info and darcs version infohallgren
... to avoid unnecessary recompilation of other modules.
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-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.
2011-12-14gf -server[=port]hallgren
You can now specify which port the HTTP server should run on in server mode. The default is 41296.
2011-11-02merge GF.Infra.Modules and GF.Grammar.Grammar. This is a preparation for the ↵kr.angelov
separate PGF building
2011-09-26don't count app nodes in term sizeaarne
2011-09-25generalized show_dependencies to take a list of constants as its argumentaarne
2011-09-24bug fixes in code size analysisaarne
2011-09-22the sd -size command now shows the size of all code needed for defining an operaarne
2011-09-21statistics on grammar size in terms of constructorsaarne
2011-09-21commands ss to show source, and sd to show the dependencies of a constantaarne
2011-09-20command ss to show source (including gfo) in text; to be extendedaarne
2011-08-31GF.Compile.Coding: cleaner code hallgren
Refine function codeTerm into codeTerm, codeLTerm and codeLTerms.
2011-08-30GF.Infra.Modules: keep the modules of a grammar in a finite map instead of a ↵hallgren
list This speeds up the compilation of PhrasebookFin.pgf by 12%, mosly by speeding up calls to lookupModule in calls from lookupParamValues, in calls from allParamValues. The invariant "modules are stored in dependency order" is no longer respected! But the type MGrammar is now abstract, making it easier to maintain this or other invariants in the future.
2011-08-25reload command in shellaarne
2011-04-20Ctrl-C shouldn't terminate the GF shellhallgren
This quick fix should make Ctrl-C in the GF shell behave more like it does in other shells: even if no command is running, Ctrl-C now just gives you a new prompt instead of terminating the shell.
2011-04-15GFI.hs: some refactoring for readabilityhallgren
Also some minor changes in how Ctrl-C is handled and how CPU time is measured.
2011-04-13Added a preliminary "gf -server" mode.hallgren
The command "gf -server" now starts a simple HTTP server on port 41295, providing a simple web API to the GF compiler. It currently support the follwing operations: * creating new temporary directories for grammar uploads, * uploading grammars files for use in the GF shell, * executing GF shell commands, and * accessing static files. This means that GF now depends on some additional networking related packages, but they should be available and easy to install on all platforms. There is also a new configuration flag "server" in gf.cabal, so GF will be compiled without support for server mode if the extra packages are unavailable. Note that running gf -server while connected to the internet can be a security risk. To prevent unauthorized access to the rest of the system, it is advisable to run the server in GF_RESTRICTED mode and as a user with suitably restricted file permissions.
2011-04-04GFI.hs: refactoring to add a function for executing a single GF shell command.hallgren
The intention is to use the new function to implement a web service API to the GF shell.
2011-04-04Add build info to the GF shell welcome messagehallgren
2011-03-03GF shell restricted modehallgren
By setting the environment variable GF_RESTRICTED before starting GF, the shell will be run in restricted mode. This will prevent the GF shell from starting arbitrary system commands (most uses of System.Cmd.system are blocked) and writing arbitrary files (most commands that use writeFile et al are blocked). Restricted mode is intended minimize the potential security risks involved in allowing public access to the GF shell over the internet. It should be used in conjuction with system level protection mechanisms (e.g. file permissions) to make sure that a publicly acessible GF shell does not give access to parts of the system that should not be publicly accessible.
2011-02-28the command show_operations to inspect opers in scopeaarne
2011-02-25Predef.error surfaces as error message in compilation and cc commandaarne
2010-12-14option cc -list addedaarne
2010-12-10preparing resource api for multilingual documentationaarne
2010-07-01reorganize the modules in GF.Compile.*krasimir
2010-07-01redesign the open-literals APIkrasimir
2010-04-22removed mention of 2.9 welcome, and some traces in visualizationaarne
2010-04-19fix command cc for Unicodekrasimir
2010-04-19always use Haskeline. drop Readline & Editlinekrasimir
2010-04-19use the native unicode support from GHC 6.12krasimir
2010-04-06dependency graph can be restricted to some modules; added help dgaarne
2010-03-22store and propagate the exact source location for all judgements in the ↵krasimir
grammar. It may not be used accurately in the error messages yet