Commit Graph

347 Commits

Author SHA1 Message Date
hallgren
aa9280b287 Workaround for a problem with lock fields
This problem showed up after delaing eta expansion until just before partial
evaluation
2013-09-10 13:43:59 +00:00
hallgren
b93f817058 new-comp: delay eta expansion until just before partial evaluation
This seems to work for the most part, but a problem showed up in WordsCat.gf in
the phrasebook.
2013-05-30 16:01:12 +00:00
hallgren
bf5dfb2293 Nonlinear patterns in concrete syntax are now detected and reported as errors
Before, they were silently converted to linear patterns.
Nonlinear patterns in MorphoCat.gf, ParadigmsGre.gf and ParadigmsFin.gf have
been make linear by renaming pattern variables.
2013-09-09 19:52:08 +00:00
hallgren
3543cb7a16 partial evaluator: prettier complaint about nonlinears patterns 2013-09-09 16:23:01 +00:00
hallgren
990789eb91 partial evaluator: complain about nonlinear patterns 2013-09-09 15:53:14 +00:00
hallgren
83283b0d6a Fix an old name shadowing bug in concrete syntax by removing the refresh pass
The refresh pass does not correctly keep track of the scope of local variables
and can convert things like \x->(\x->x) x into \x1->(\x2->x2) x2. Fortunately,
it appears that the refresh pass is not needed anymore, so it has been removed.
2013-09-09 14:29:57 +00:00
hallgren
d7916c1b08 Fix an old bug that prevented pattern matching agains values containg tables
The function GF.Grammar.PatternMatch.isInConstantForm returned False for all
tables, causing matchPattern to fail, claiming that "variables occur in" the
term if it contains tables.

This problem is several years old, confirmed present in GF 3.2.10 (Oct 2010).
2013-09-05 15:20:41 +00:00
kr.angelov
df26b134fc fix in the GF compiler and runtime which let us to define pre construct detecting whether this is the last token. 2013-09-03 07:51:25 +00:00
kr.angelov
a20cd77d25 nonExist now does the expected thing 2013-08-23 13:17:45 +00:00
hallgren
fad63a14be Better error messages for attempts to redefine predefined constants
Instead of just "syntax error", you now get e.g.

   PType is a predefined constant, it can not be redefined

This is a simple change in the parser.
2013-08-07 19:36:09 +00:00
aarne
850e02cb6e hs datatype generation for empty abstract types added 2013-07-24 08:11:16 +00:00
virk.shafqat
d1d5543c26 Improvements In Sindhi RG 2013-06-15 20:02:00 +00:00
hallgren
d010dfdcfa Update the usage text for the --output-format option
It needs to be updated manually when the list of available output format
changes.
2013-06-10 12:00:14 +00:00
hallgren
5b36461c1d GF.Text.Transliterations: avoid error prone function Data.Map.fromAscList 2013-06-02 10:10:46 +00:00
aarne
f33059ae39 Prasad's sanskrit transliteration ; MiniresourceSan now compiles but is mostly incorrect due to missing paradigms 2013-05-31 16:25:42 +00:00
kr.angelov
4394b8a3bc a bit more informative error message in GrammarToPGF 2013-04-22 12:14:39 +00:00
kr.angelov
09c1bd662d the option -old for the vp command is now redundant 2013-04-19 11:15:18 +00:00
kr.angelov
4e2044ab99 remove the dead code left behind by Peter Ljunglöf in VisualizeTree 2013-04-19 11:13:07 +00:00
kr.angelov
a591160b94 fix the command options for the vd command in the shell 2013-04-19 11:11:57 +00:00
hallgren
5bce1d7a16 gf -s/-q now silences "no linearization of" warnings 2013-04-10 23:00:01 +00:00
hallgren
b8ce5ef5b3 PGF.hs: export function missingLins
Also in Commands.hs: be explicit about things imported from the PGF library
that are not in the public API.
Also a couple of haddock documentation fixes.
2013-04-08 15:38:11 +00:00
hallgren
cc0743ade1 Compiler.hs: ghc 7.6.2 compatibility 2013-04-05 20:37:37 +00:00
hallgren
c02d5b188b Prevent Unicode characters in warning messages from stopping grammar compilation
When compiling a grammar containing characters that are not supported in the
current locale, warning messages could cause GF fail with 

  hPutChar: invalid argument (Invalid or incomplete multibyte or wide character)

With this quick fix, warning messages that can not be displayed are silently
truncated instead, and compilation continues.
2013-04-03 06:42:08 +00:00
aarne
e56bfe8811 option pt -funs to show all fun's in a tree 2013-03-29 11:45:42 +00:00
hallgren
80fe693546 Fix a problem with pattern macros in pre { } expressions
The old partial evaluator has special rules to convert pattern macros in
pre { } expressions. These rules were missing in the new partial evaluator.
2013-03-16 13:36:23 +00:00
aarne
7d1040ffb9 pt -nub to remove duplicate trees from a list returned e.g. by a parser 2013-03-13 13:43:30 +00:00
hallgren
e5ce4d4b1e partial evaluator: push predefined functions inside variants
This should prevent errors like

Internal error in Compute.ConcreteNew:
    Applying Predef.drop: Expected a value of type String, got VFV [VString "gewandt",VString "gewendet"]
2013-03-12 16:36:58 +00:00
aarne
78b3487cb7 command pt -subtrees that analyses a tree into the set of subtrees. Using pt -subtrees <bigtree> | l -treebank for debugging the lin of a big tree 2013-03-12 14:58:06 +00:00
hallgren
d1c5fafc69 Additional changes for GHC 7.4 & 7.6 compatibility 2013-03-11 12:57:09 +00:00
Sergei Trofimovich
0173b5f4ff ghc-7.6: allow directory-1.2
Get rid of old-time depend (and ClockTime in favour of UTCTime).
time-compat helps to retain backward compatibility with directory-1.1
and lower.
2013-03-09 21:38:43 +00:00
hallgren
8200145513 Fix a bug that could cause "Prelude.head: empty list"
In Data.Operations, the function topoTest2 assumed too much about the form of
the input, compared to the older function topoTest.
2013-02-28 17:46:13 +00:00
hallgren
95d77e3c37 pattern match length estimation code simplication 2013-02-28 15:13:20 +00:00
hallgren
0feb386691 Faster regular expression pattern matching in the grammar compiler.
The sequence operator (x+y) was implemented by splitting the string to be
matched at all positions and trying to match the parts against the two
subpatterns. To reduce the number of splits, we now estimate the minimum and
maximum length of the string that the subpatterns could match. For common
cases, where one of the subpatterns is a string of known length, like
in (x+"y") or (x + ("a"|"o"|"u"|"e")+"y"), only one split will be tried.
2013-02-27 20:59:43 +00:00
hallgren
95c4cbb8f5 GF grammar pretty printer improvements
Allow line breaks in more places to make large terms more readable.
2013-02-27 14:22:47 +00:00
kr.angelov
4922ab6cc4 now the beam size for the statistical parser can be configured by using the flag beam_size in the top-level concrete module 2013-02-12 10:53:13 +00:00
aarne
f9a32dca3b pg -lexc now writes a list of multichar symbols and a title ("Root") for the lexicon, as required by Xerox lexc 2013-02-03 10:03:15 +00:00
hallgren
d4b6d1b6fe Better error message for unsupported token gluing
Instead of "Internal error in ...", you now get a proper error message with
a source location and a function name.
2013-01-29 16:25:03 +00:00
hallgren
14c8da214c Fix a bug with record extension
Add a conversion rule for ({ l1 = e } ** x).l2 in PMCFG generation. (A rule
for the symmetric case (x ** { l1 = e }).l2 was added some time ago.)
2013-01-29 14:59:16 +00:00
hallgren
a559e51608 Quick fix to render some parser error messages from UTF-8-encoded source files correctly.
The parser works on raw byte sequences read from source files. If parsing
succeeds the raw byte sequences are converted to proper Unicode characters 
in a later phase. But the parser calls the function buildAnyTree, which can 
fail and generate error messages containing source code fragments, which might
then containing raw byte sequences. To render these error messages correctly, 
they need to be converted in accordance with the coding flag in the source 
file. This is now done for UTF-8-encoded source files, but should ideally also
be done for other character encodings. (Latin-1-encoded files never suffered 
from this problem, since raw bytes are proper Unicode characters in this case.)
2013-01-28 17:23:02 +00:00
hallgren
713e883ad7 Better error message for Predef.error
+ Instead of "Internal error in ...", you now get a proper error message with
  a source location and a function name.
+ Also added some missing error value propagation in the partial evaluator.
+ Also some other minor cleanup and error handling fixes.
2013-01-28 16:12:56 +00:00
aarne
1eb45d955b improved error message for overloading in case the given signature looks the same as one of the expected ones: it shows full records rather than just lock fields. 2013-01-28 14:00:23 +00:00
hallgren
a8f281491c partial evaluator: fix token glueing bug
"a"+("b"++"c") was simplified to "bb"++"c" instead of "ab"++c.
2013-01-11 15:14:42 +00:00
hallgren
12dec2503d bug fix in the new partial evaluator
It can leave wildcard tables in their origial form, but it easy to handle
them in the unfactor function in GeneratePMCFG.
2012-12-20 16:41:43 +00:00
aarne
5ff33f47be added alltenses to the default search path (just like prelude) 2012-12-20 16:05:34 +00:00
hallgren
ece3e33c52 partial evaluator bug fix
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-19 23:12:37 +00:00
hallgren
b4207d1b00 GF.Grammar.Lookup: new function lookupResDefLoc
It's like lookupResDef but it includes a source location in the output.
2012-12-19 23:08:56 +00:00
hallgren
c3beefba47 partial evaluator bug fix
Int was missing from the list of predefined canonical constants.
2012-12-18 13:03:20 +00:00
kr.angelov
20aaa4a989 The first prototype for exhaustive generation in the C runtime. The trees are always listed in decreasing probability order. There is also an API for generation from Python 2012-12-14 15:32:49 +00:00
hallgren
9ab3a6034d Add language extension for ghc<7.4
FlexibleInstances does not imply TypeSynonymInstances, apparently.
2012-12-14 14:21:46 +00:00
hallgren
d7e3c869c2 More work on the new partial evaluator
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-14 14:00:21 +00:00