1
0
forked from GitHub/gf-core
Commit Graph

656 Commits

Author SHA1 Message Date
aarne 3aa14435de fixed a bug in Eq instance generation for GADT and lexical categories 2017-03-22 22:25:21 +00:00
krasimir 55e975e47b a better error message 2017-03-07 23:17:24 +00:00
krasimir ed45e0d9f4 GF.Compile.Compute.ConcreteNew now handles Predef.Float 2017-03-07 19:50:43 +00:00
krasimir a8ba233986 bugfix in record subtyping checking 2017-03-07 17:53:56 +00:00
krasimir 316c198e64 GF.Grammar.Printer now has a Terse mode which prints record types with lock fields with their corresponding abstract categories 2017-03-07 08:24:00 +00:00
krasimir 821bd7bf6e fix for EPatt 2017-03-06 17:15:46 +00:00
krasimir 0d08ec8756 type checking EPatt 2017-03-06 16:24:58 +00:00
krasimir 635faeeadd GF.Compile.Compute.ConcreteNew now can handle EPattType 2017-03-06 15:44:25 +00:00
krasimir 842df74cf5 some missing patterns 2017-03-06 14:44:03 +00:00
krasimir 04112682ec added overload resolution in the experimental type checker 2017-03-06 14:09:16 +00:00
krasimir 0debac9f98 some progress on the experimental type checker for the concrete syntax 2017-03-03 16:37:22 +00:00
aarne fbce74dc16 corrected fg generation for lexical categories, to avoid a type error in generated code 2017-02-24 20:50:36 +00:00
hallgren cc6755be33 Fix compilation errors caused by changes in PGF2
These prevented GF from being built with C run-time support (-fc-runtime).
2017-02-21 13:21:59 +00:00
krasimir 00f15826af improve the documentation for PGF2 2017-01-25 20:30:54 +00:00
aarne 7849184875 BNF grammars (.bnf or .cf) can have rules without semicolons, as in the GF book examples. However, if the grammar has any multiline rules, all of them must have semicolons. 2016-09-05 21:15:44 +00:00
hallgren 64bdd44175 GF cloud: more readable formatting of the GF version page
Factor out common CSS from gfse/editor.css into clouds.css.
2016-06-15 10:20:30 +00:00
hallgren 674b14a832 PGF service & minibar: only show dependency diagrams if the labels are known
+ 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-06-09 13:12:14 +00:00
hallgren 0635f546f3 Changes for compatibility with GHC 8.0.1 2016-05-22 20:15:31 +00:00
hallgren ca97f6d217 GF.Command.Commands2: adapt gf -cshell to the changes in the previous patch 2016-04-07 14:55:13 +00:00
hallgren 58cd043fa8 GF shell: fix a parsing problem with the cc command
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-07 13:40:05 +00:00
hallgren 6d5ecf7c3f Lexer.x & Parser.y: add a partial parser for terms
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-07 13:32:14 +00:00
hallgren c4ea470eb1 Lexer.x: fix cyclic Functor instance
It looks like I introduced this cyclic definition in August 2014, but since
it isn't used, it hasn't been a problem...
2016-04-06 13:46:48 +00:00
krasimir 3e8ec361d8 fix the handling of separators in BNFC which are not nonempty 2016-03-22 13:13:35 +00:00
krasimir 4fb187b49c CFGtoPGF is now extended to support context-free grammars with primitive parameters 2016-03-22 10:28:15 +00:00
krasimir 9780b38469 added missing module GF.Grammar.BNFC 2016-03-21 20:03:28 +00:00
krasimir 2bd4f2ef04 fix comment in GF.Grammar.CFG 2016-03-21 19:33:14 +00:00
krasimir 8cd59c6d98 initial support for BNFC syntax in context-free grammars for GF. Not all features are supported yet. Based on contribution from Gleb Lobanov 2016-03-21 13:27:44 +00:00
krasimir 651eab05d8 bugfix: GF.Compile.CFGtoPGF now supports literal categories 2016-03-21 13:26:32 +00:00
krasimir 27313fb336 more progress on the typechecker 2016-03-15 14:16:17 +00:00
krasimir f4cf7493e3 current state of the experimental typechecker 2016-03-07 20:20:47 +00:00
krasimir bd337427eb add missing cases in vapply in the partial evaluator 2016-03-03 06:59:50 +00:00
krasimir c6218d768a fix in the typechecker 2016-03-02 21:28:54 +00:00
krasimir 9d71727545 a better interface between the type checker and the partial evaluator 2016-03-02 16:22:56 +00:00
krasimir e51ad77836 the experimental type checker in GF.Compile.TypeCheck.ConcreteNew is now rewriten to use the complete evaluator in GF.Compile.Compute.ConcreteNew. The old sketchy implementation in GF.Compile.Compute.ConcreteNew1 is now removed. 2016-03-02 13:38:02 +00:00
leiss 398212bd65 add lexer and unlexer for Ancient Greek accent normalization 2016-02-23 16:30:39 +00:00
hallgren a6c2ef97ff GF shell, cc command: try to compute pre{...} tokens in token sequences
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-02 16:41:18 +00:00
hallgren d5d4f11684 GF.Data.Str: change matchPrefix to agree with the GF book and the run-time 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-01 15:14:27 +00:00
hallgren 6d51e7f790 GF.Data.Str: unexport & comment out unused functions 2015-12-01 14:32:24 +00:00
aarne d1ac9b1d0f vd -conll2latex now converts conll to latex. Without going through GF trees, but as a service to the dependency parser community. 2015-11-23 10:43:03 +00:00
aarne c43a650c00 added -output=latex to visialize_dependencies. This generates more 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-17 09:11:10 +00:00
aarne e1ca534f70 the visualization commands (aw,vd,vp,vt) can now show multiple trees. 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-05 16:47:41 +00:00
aarne 72004a98f6 improved documentation of vp -showdep 2015-11-05 08:23:33 +00:00
aarne 176c208343 dependency labels in parse trees now with the -deps flag, -file=labels_file 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-04 20:36:47 +00:00
aarne 1b7d61ea2e prepared visualize_parse for showing dependency labels 2015-11-04 17:28:09 +00:00
hallgren 2ace6089e3 Fix bug in gf -server mode with /gfshell requests not updating the state of 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-28 15:03:19 +00:00
hallgren 1e88cf380a GF.Interactive2: extension FlexibleContexts is needed for GHC 7.10 compatibility 2015-10-02 09:59:55 +00:00
hallgren f122e2d351 cc -trace: don't try to show the bodies of lambda abstractions
This triggers evaluation of terms with free variables, which the partial
evaluator isn't equipped to handle.

Reported by Aarne.
2015-09-30 10:30:19 +00:00
hallgren 11c08b9167 GF source lexer: allow numeric character escapes in string literals
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-29 12:18:35 +00:00
hallgren af70a134f5 Preliminary new shell feature: cc -trace.
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-28 22:23:56 +00:00
hallgren 6aa4a7b737 Remove debug output introduced in previous patch
Oops.
2015-09-11 14:46:31 +00:00