summaryrefslogtreecommitdiff
path: root/src/compiler/GF
AgeCommit message (Collapse)Author
2017-01-25improve the documentation for PGF2krasimir
2016-09-05BNF grammars (.bnf or .cf) can have rules without semicolons, as in the GF ↵aarne
book examples. However, if the grammar has any multiline rules, all of them must have semicolons.
2016-06-15GF cloud: more readable formatting of the GF version pagehallgren
Factor out common CSS from gfse/editor.css into clouds.css.
2016-06-09PGF service & minibar: only show dependency diagrams if the labels are knownhallgren
+ The PGF service now reads and caches dependency label configuration files. + The grammar info returned by command=grammar has a new boolean field 'hasDependencyLabels' to indicate if dependency labels were found for the grammar. Also, command=deptree will now fail if no labels are present. + The minibar only shows word dependency trees if labels are present. + Also changed the type of getDepLabels from [String] -> Labels to String -> Labels, since all uses were in the form "getDepLabels . lines".
2016-05-22Changes for compatibility with GHC 8.0.1hallgren
2016-04-07GF.Command.Commands2: adapt gf -cshell to the changes in the previous patchhallgren
2016-04-07GF shell: fix a parsing problem with the cc commandhallgren
This patch fixes a problem introduced last year when the GF shell was refactored to allow more commands to be treated uniformly and be part of pipes. The cc command was one of those commands, but unfortunately this introduced a parsing problem, e.g. > cc "last" constant not found: last > cc "last"++"year" command not parsed: cc "last"++"year" This happened because the generic command line parser in GF.Command.{Abstract,Parse} assumes that all commands have an argument of type PGF.Expr. Commands that expect other types of arguments have to use PGF.showExpr combined with other conversion to the argument type they expect. The cc command excpets a GF.Grammar.Term, and unfortunately not all terms survice the roundtrip through PGF.Expr, in part because of an additional hack to allow strings to be roundtripped through PGF.Expr without adding superfluous double quotes. To solve the problem, this patch + makes room for arguments of type Term in the Argument type in GF.Command.Abstract. + makes a special case for the cc command in GF.Command.Parse, by calling the partial parser 'runPartial pTerm' recently added in GF.Grammar.Lexer and GF.Grammar.Parser. Care was taken so that that "|" and ";" can be used both inside terms and as separators between commands in the shell, e.g. things like the following now work: > cc ("a"|"b") | ps -lexcode variants { "a" ; "b" } + introduces a type CommandArgument that replaces [Expr] as the type of values passed between commands in pipes. It has room for values of type [Expr], [String] and Term, thus eliminating the need to roundtrip through the Expr type all the time. The hack to avoid adding superfluous quotes when strings are roundtripped through Expr has been left in place for now, but can probably be removed.
2016-04-07Lexer.x & Parser.y: add a partial parser for termshallgren
Lexer.x: Change the parser monad type P to allow the remaining input to be returned after a partial parse. Add function runPartial :: P t -> String -> Either (Posn, String) (String, t) Parser.y: Add a partial parser pTerm for nonterminal Exp1. Re-export runPartial.
2016-04-06Lexer.x: fix cyclic Functor instancehallgren
It looks like I introduced this cyclic definition in August 2014, but since it isn't used, it hasn't been a problem...
2016-03-22fix the handling of separators in BNFC which are not nonemptykrasimir
2016-03-22CFGtoPGF is now extended to support context-free grammars with primitive ↵krasimir
parameters
2016-03-21added missing module GF.Grammar.BNFCkrasimir
2016-03-21fix comment in GF.Grammar.CFGkrasimir
2016-03-21initial support for BNFC syntax in context-free grammars for GF. Not all ↵krasimir
features are supported yet. Based on contribution from Gleb Lobanov
2016-03-21bugfix: GF.Compile.CFGtoPGF now supports literal categorieskrasimir
2016-03-15more progress on the typecheckerkrasimir
2016-03-07current state of the experimental typecheckerkrasimir
2016-03-03add missing cases in vapply in the partial evaluatorkrasimir
2016-03-02fix in the typecheckerkrasimir
2016-03-02a better interface between the type checker and the partial evaluatorkrasimir
2016-03-02the experimental type checker in GF.Compile.TypeCheck.ConcreteNew is now ↵krasimir
rewriten to use the complete evaluator in GF.Compile.Compute.ConcreteNew. The old sketchy implementation in GF.Compile.Compute.ConcreteNew1 is now removed.
2016-02-23add lexer and unlexer for Ancient Greek accent normalizationleiss
2015-12-02GF shell, cc command: try to compute pre{...} tokens in token sequenceshallgren
This is implemented as a simple post-processing step after partial evaluation to try compute pre{...} tokens in token sequences. Nothing is done to deal with intervening free variants. This was done in response to a query from René T on the gf-dev mailing list.
2015-12-01GF.Data.Str: change matchPrefix to agree with the GF book and the run-time ↵hallgren
system The matchPrefix function is used in str2strings and the partial evaluator to compute pre{...} tokens. But unlike the description in the GF book and the implementation in the run-time system, matchPrefix looked at the concatenation(!) of all following tokens and not just the next token when deciding how to compute a pre{...} token. This is a backwards incompatible change, but it is subtle and probably won't cause any problems. In particular, the example grammars are unaffected.
2015-12-01GF.Data.Str: unexport & comment out unused functionshallgren
2015-11-23vd -conll2latex now converts conll to latex. Without going through GF trees, ↵aarne
but as a service to the dependency parser community.
2015-11-17added -output=latex to visialize_dependencies. This generates more ↵aarne
familiar-looking output than the default graphviz, which can moreover be pasted into LaTeX documents. Some more work is needed to make long sentences look nice and fit on a page; a constant word length is now used to simplify computing the coordinates.
2015-11-05the visualization commands (aw,vd,vp,vt) can now show multiple trees. ↵aarne
Previously they only showed one tree even if there were for instance after ambiguous parsing. The reason was that dot (graphviz) ignored all graphs but the first one. Now the graphs are put into separate files. The 'convert' command from ImageMagick package is used to combine them to one pdf. If this is a problem, the old behaviour can be restored by the -number=1 option to the tree-generating command, which cuts away all trees but the one and doesn't require ImageMagick.
2015-11-05improved documentation of vp -showdepaarne
2015-11-04dependency labels in parse trees now with the -deps flag, -file=labels_file ↵aarne
for configuration. With -nocat option this shows reasonable dep trees, more familiar looking than the vd command. With -showfun flag, the tree gives a rather complete picture of the analysis of the sentence.
2015-11-04prepared visualize_parse for showing dependency labelsaarne
2015-10-28Fix bug in gf -server mode with /gfshell requests not updating the state of ↵hallgren
the shell The test for the quit command had the wrong polarity. The problem was reported by Fahime Ghasemi on gf-dev mailing list.
2015-10-02GF.Interactive2: extension FlexibleContexts is needed for GHC 7.10 compatibilityhallgren
2015-09-30cc -trace: don't try to show the bodies of lambda abstractionshallgren
This triggers evaluation of terms with free variables, which the partial evaluator isn't equipped to handle. Reported by Aarne.
2015-09-29GF source lexer: allow numeric character escapes in string literalshallgren
This makes the output from PGF.showExpr (and other Haskell code that uses the Prelude.show function to show strings) parsable as GF source code in more cases. This is a workaround for the problem that GHC's implementation of the show function uses numeric escapes for printable non-ASCII characters, e.g. show "dålig" = "d\229lig"...
2015-09-28Preliminary new shell feature: cc -trace.hallgren
You can now do things like cc -trace mkV "debug" to see a trace of all opers with their arguments and results during the computation of mkV "debug".
2015-09-11Remove debug output introduced in previous patchhallgren
Oops.
2015-09-11Parallel compilation: "gf -make -j" and "gf -make -j=n" now work as expectedhallgren
* "gf -make -j=n" uses n parallel threads. * "gf -make -j" adapts to the number of processors in the system. This mimics how "cabal build -j" and "ghc --make -j" works. Support for this is implemented in the new module GF.System.Concurrency and it depends on the function Control.Concurrent.setNumCapabilities, which is only available in GHC>=7.6 (base>=4.6). GF can still be compiled with GHC<7.6, but then you have to use +RTS -N -RTS to take advantage of multicore processors. To detect the number of processors in the system, the code depends on a foreign import of a C function in the GHC run-time system.
2015-09-03GF shell: write_file now writes one tree per linehallgren
This compensates for other changes that removed line breaks. Maybe it should have a -lines options like ps and rf?
2015-08-31GF.Infra.SIO: The SIO monad now supports putStr in addition to putStrLnhallgren
Also included some unrelated minor changes.
2015-08-28Comment out some dead code found with -fwarn-unused-bindshallgren
Also fixed some warnings and tightened some imports
2015-08-26GF shell: change parse & linearize to obtain useful results from p|l and l|p ↵hallgren
in more cases These changes are inspired by the gf -cshell implementation of these commands. The output of the linearize command has been changed to remove superfluous blank lines and commas, and deliver the result as a list of strings instead of a single multi-line string. This makes it possible to use -all and pipe the results to the parse command. This also means that with -treebank -all, the language tag will be repeated for each result from the same language. The parse command, when trying to parse with more than one language, would "forget" other results after a failed parse, and thus not send all successful parses through the pipe. For example, if English is not the first language in the grammar, p "hello" | l would output nothing, instead of translations of "hello" to all languages, forcing the user to write p -lang=Eng "hello" | l instead, to get the expected result. The cause of this behaviour was in the function fromParse, which was rather messy, so I assume it is not intentional, but the result of a programming mistake at some point. The fromParse function has now been refactored from a big recursive function into fromParse opts = foldr (joinPiped . fromParse1 opts) void where the helper functions fromParse1 deals with a single parse result and joinPiped combines multiple parse results.
2015-08-21GF shell bug fix: visualize_parse didn't accept the -lang flaghallgren
Even though the -lang flag was handled in the implementation, it was not documented, and GF.Command.Interpreter rejects undocumented flags: option not interpreted: lang This must be a fairly old bug, so it suggests that the vp command isn't used much...
2015-08-21GF -cshell: implement visualize_parsehallgren
Supported options and flags: -lang -format -view None of the rendering options available in the Haskell run-time are supported.
2015-08-21add a type signature in GF.Interactive2 to make ghc-7.6.3 happykrasimir
2015-08-21gf -cshell: implement visualize_treehallgren
But the following options are not supported: -mk -nocats -nofuns
2015-08-20gf -cshell: implement a subset of print_grammar and abstract_infohallgren
pg supports only the -funs, -cats and -langs output modes. ai IDENTIFIER shows info about a category or a function. ai can not type check and refine metavariables in expressions.
2015-08-18gf -cshell: linearize: implement options -all -list -treebankhallgren
Options -all and -list use PGF2.linearizeAll, which lists all variants, but not all forms... Also, there is no attempt to be compatible with the output from the Haskell run-rime shell, which produces superfluous blank lines (-all) or commas (-list), and mixes tagged and untagged lines (-treebank -all).
2015-08-18GF shell: restore the eh command to working order and document ithallgren
Also, when the command line parser fails, append the problematic command line to the error message "command not parsed".
2015-08-17GF shell: add the start options to GFEnv, turn "reload" into an ordinary commandhallgren