summaryrefslogtreecommitdiff
path: root/src/compiler
AgeCommit message (Collapse)Author
2015-01-07Translating linearization functions to Haskell: use qualified names to avoid ↵hallgren
name clashes All languages in the Phasebook can now be converted to compilable Haskell code. STILL TODO: - variants - pre { ... }
2015-01-06Translating linearization functions to Haskell: significant code size reductionshallgren
+ Instead of including lists of parameter values generated by GF, generate code to enumerate parameter values (in the same order as GF). This seems to give a factor of 2-3 code size reduction in the Phrasebook (e.g. from 84MB to 25MB for Hin, from 338MB to 154MB for Fre). + Deduplicate table entries, i.e. convert "table [..,E,..,E,..,E,..]" into "let x = E in table [..,x,..,x,..,x,..]". This gives even more significant code size reduction in some cases, e.g. from 569MB to 15MB for PhrasebookFin. All phrasebook languages can now be converted to compilable Haskell code, except PhrasebookPes, which still has the name clash problem.
2015-01-06More work on translating linearization functions to Haskellhallgren
Many Phrasebook languages can now be converted to compilable Haskell code. Some languages (Fre, Hin, Snd, Urd) generate too much Haskell code to be practically useful (e.g. 338MB for Fre). One language (Fin) took too long to convert to Haskell. One language (Pes) has problems with name clashes in the generated Haskell code. STILL TODO: - variants - pre { ... } - reduce code duplication for large tables - generate qualified names to avoid name clashes
2014-12-11Work in progress on translating linearization functions to Haskellhallgren
The translation is currently good enough to translate all concrete syntaxes of the Foods and Letter grammars, and some concrete syntaxes of the Phrasebook grammar (e.g. PhrasebookEng & PhrasebookSpa works, but there are problems with e.g. PhrasebookSwe and PhrasebookChi) This functionality is enabled by running gf -make -output-format=haskell -haskell=concrete ... TODO: - variants - pre { ... } - eta expansion of linearization functions - record subtyping can still cause type errors in the Haskell code in some cases - reduce code large tables
2014-12-11GF.Grammar.Macros: generalize the type of collectOphallgren
New type: collectOp :: Monoid m => (Term -> m) -> Term -> m
2014-12-11GF.Server: remove some code duplicationhallgren
2014-12-08Haddock documentation: expose exportPGF, some other small improvementshallgren
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-11-10Documentation improvements and cleanup relating to the IOE monadhallgren
Renamed appIOE to tryIOE (it is analogous to 'try' in the standard libraries). Removed unused IOE operations & documented the remaining ones. Removed/simplified superfluous uses of IOE operations.
2014-11-10Some work to improve the structure of the haddock documenationhallgren
2014-10-31now (+) in the abstract syntax works, i.e. it knows how to deal with partial ↵kr.angelov
sums
2014-10-30a more efficient tail call by using the new TUCK instructionkr.angelov
2014-10-28Use terminfo to highlight warnings and errors in blue and redhallgren
This replaces the hardwired ANSI escape codes that were accidentally included in a previous patch. This adds a dependency on terminfo, but this should be unproblematic, since haskeline already depends on the same underlying C library. The color highlighting is omitted on Windows.
2014-10-28Show paths relative to the current directory in progress reportshallgren
It is much nicer to see something like - compiling FoodsSwe.gf... write file FoodsSwe.gfo - compiling FoodsTha.gf... write file FoodsTha.gfo - compiling FoodsTsn.gf... write file FoodsTsn.gfo - compiling FoodsTur.gf... write file FoodsTur.gfo - compiling FoodsUrd.gf... write file FoodsUrd.gfo linking ... OK Writing Foods.pgf... instead of - compiling /Users/hallgren/src/GF/gf/examples/foods/FoodsSwe.gf... write file /Users/hallgren/src/GF/gf/examples/foods/FoodsSwe.gfo - compiling /Users/hallgren/src/GF/gf/examples/foods/FoodsTha.gf... write file /Users/hallgren/src/GF/gf/examples/foods/FoodsTha.gfo - compiling /Users/hallgren/src/GF/gf/examples/foods/FoodsTsn.gf... write file /Users/hallgren/src/GF/gf/examples/foods/FoodsTsn.gfo - compiling /Users/hallgren/src/GF/gf/examples/foods/FoodsTur.gf... write file /Users/hallgren/src/GF/gf/examples/foods/FoodsTur.gfo - compiling /Users/hallgren/src/GF/gf/examples/foods/FoodsUrd.gf... write file /Users/hallgren/src/GF/gf/examples/foods/FoodsUrd.gfo linking ... OK Writing Foods.pgf...
2014-10-28A couple of haddock documentation improvementshallgren
2014-10-26an explicit SAVE instructionkr.angelov
2014-10-22Various small changes for improved documentationhallgren
2014-10-22an explicit PUSH_FRAME instructionkr.angelov
2014-10-21ModuleName and Ident are now distinct typeshallgren
This makes the documentation clearer, and can potentially catch more programming mistakes.
2014-10-21Renaming SourceGrammar to Grammar and similarly for some related typeshallgren
Included renamings: SourceGrammar -> Grammar SourceModule -> Module SourceModInfo -> ModuleInfo emptySourceGrammar -> emptyGrammar Also introduces a type synonym (which might be good to turn into a newtype): type ModuleName = Ident The reason is to make types like the following more self documenting: type Module = (ModuleName,ModuleInfo) type QIdent = (ModuleName,Ident)
2014-10-20use of 'head' in TypeCheck/RConcrete created an uncomprehensible error ↵aarne
message. Now checking for the emptiness of the list concerned, so that the error can be found.
2014-10-20Some small documentation improvementshallgren
2014-10-20type IOE a = IO ahallgren
IOE used to be a monad with extra error handling built on top of the IO monad, But the IO monad already supports error handling, so this construction was a superfluous. The new 'instance ErrorMonad IOE' is defined to preserve the previous error handling behaviour, i.e. the function 'handle' only catches errors thrown with 'raise' (or 'fail') and not other errors in the IO monad.
2014-10-20Remove some dead codehallgren
* The following modules are no longer used and have been removed completely: GF.Compile.Compute.ConcreteLazy GF.Compile.Compute.ConcreteStrict GF.Compile.Refresh * The STM monad has been commented out. It was only used in GF.Compile.SubExpOpt, where could be replaced with a plain State monad, since no error handling was needed. One of the functions was hardwired to the Err monad, but did in fact not use error handling, so it was turned into a pure function. * The function errVal has been renamed to fromErr (since it is analogous to fromMaybe). * Replaced 'fail' with 'raise' and 'return ()' with 'done' in a few places. * Some additional old code that was already commented out has been removed.
2014-10-19(un)lexmixed: added the other math environments than $ used in latexaarne
2014-10-17ps -lines preserves line-by-line structure when preprocessing files for ↵aarne
parsing line by line
2014-10-16Some work on the haddock documentationhallgren
2014-10-16Turn the GF compiler into a library. Main program is now in src/programs/gf.hshallgren
The module src/compiler/GF.hs now serves as a prelimiary compiler API. It just exports a selection of functions and types from the compiler. Haddock documentation can be generated with cabal haddock --hyperlink-source Also bumbed the version number to 3.6.10.
2014-10-16More haddock documentation improvementshallgren
2014-10-16finally proper stack unwind in the evaluatorkr.angelov
2014-10-15Rename modules GFI, GFC & GFServer...hallgren
... to GF.Interactive, GF.Compiler & GF.Server, respectively.
2014-10-15Fixes for the haddock documentationhallgren
2014-10-14the compiler now allows + to be used as a floating point addition in the ↵kr.angelov
abstract syntax
2014-10-14yet another bugfix in the byte codekr.angelov
2014-10-14another bugfix in the byte code generationkr.angelov
2014-10-14bugfix in the bytecode generatorkr.angelov
2014-10-09Prelude.CAPIT is now a built-in primitive. It still generates &| in the ↵kr.angelov
Haskell runtime but will be intepreted in the C runtime
2014-10-08GF.Infra.Options: change from String to Int in the type of optJobshallgren
2014-10-08now we statically allocate closures for all top-level functions and all ↵kr.angelov
nullary constructors. closures are dynamically allocated only for CAFs. this reduces memory use and time to allocate dynamic closures
2014-10-07bugfix in the byte code compilerkr.angelov
2014-10-06using instruction RET was wrong; now use EVALkr.angelov
2014-09-29minor stylistic change in GenerateBCkr.angelov
2014-09-29bugfix in the pattern matching compiler and a number of other fixes that I ↵kr.angelov
somehow did not push before
2014-09-27checked that course of value tables (table P [...]) have the correct number ↵aarne
of values w.r.t the type P. This was previously not checked, and caused hard-to-find run-time errors.
2014-09-17forgot to type check the type of a typed let expressionkr.angelov
2014-09-17appForm now skips over Typed expressionskr.angelov
2014-09-17the type checker for the abstract syntax now allows let expressions in def ↵kr.angelov
rules, since they are easily compilable to byte code. This fails in the Haskell runtime since let expressions are not allowed as abstract syntax expressions.
2014-09-11a major revision of the bytecode generator and JIT compiler. the effect is ↵kr.angelov
that now we can compute with lambda functions and with true tail recursion
2014-09-08(1) Refactor concurrency, (2) write to .gfo.tmp then rename to .gfohallgren
(1) introduces the module GF.Infra.Concurreny with lifted concurrency operators (to reduce uses of liftIO) and some additional concurrency utilities, e.g. a function for sequential logging that is used in both GF.CompileInParallel and GFServer. (2) avoids leaving broken .gfo files behind if compilation is aborted.
2014-09-05the code for def rules now uses proper graph update to preserve lazynesskr.angelov