Commit Graph

3896 Commits

Author SHA1 Message Date
hallgren c14e75706e 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 764b649959 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 6af9575a68 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
gregoire.detrez 459a9a855b Python binding: add a parsing function that accepts directly a list of tokens.
Is allows to define a tokenizer in python (or use an existing one, from nltk for instance.)
2013-01-24 13:31:34 +00:00
john.j.camilleri f633e899e9 Add fun/cat printnames to PGF web service
This is accessible vis the `browse` command, by adding the flag `printnames`
e.g.: .../Letter.pgf?command=browse&id=Recipient&format=json&printnames=1
2013-01-18 09:39:50 +00:00
hallgren d55f5b4e7b gf -server: fix bug in bug fix for current directory 2013-01-13 12:36:58 +00:00
hallgren f9551337a9 gf -server: small logging improvements 2013-01-12 18:48:23 +00:00
hallgren cfb72bad8b gf -server: defend against problems with the current directory caused unhandled errors 2013-01-12 17:11:31 +00:00
john.j.camilleri 776539803d Syntax editor: initial support for string literals
Also a bug fix when switching to editor, although this still messes up
when using the letters grammar.
Also updated readme with options, and some style improvements.
2013-01-11 15:33:17 +00:00
john.j.camilleri 5dfca98088 Syntax editor: add tooltips to buttons 2013-01-11 12:45:24 +00:00
john.j.camilleri d13424482d Syntax editor: remove beta label 2013-01-11 11:38:45 +00:00
hallgren 3712b6988e 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 4b0e05f9c7 Fixes for minibar offline
Tested it in Firefox 18 (which has the new Ionmonkey JavaScript engine).
Still get stack overflows.
2013-01-09 16:44:18 +00:00
hallgren eb21f73fd3 PGF service: new command: download
This makes it possible to download PGF files from servers where the PGF service
is installed.

I am also considering making commmand=download the default instead of
command=grammar.
2013-01-09 13:28:45 +00:00
kr.angelov ccc3d6be0d fix warnings in pgf-parse.c 2013-01-08 12:53:49 +00:00
peter.ljunglof 168d39bf6d PGF installation instructions for Mac OSX 2013-01-08 10:23:25 +00:00
peter.ljunglof 88e67b92a4 Made meta probs an optional argument instead of hard-coded in pgf-translate 2013-01-08 10:20:46 +00:00
peter.ljunglof d2ae113652 New PGF utility: pgf-parse 2013-01-08 10:19:53 +00:00
kr.angelov 79bf7056f2 now the Python binding has an alternative representation for abstract trees which is composed of Python objects. The new representation is not integrated with the core runtime yet 2013-01-07 15:11:12 +00:00
kr.angelov 3be31c62e9 a new reasoner in the C runtime. It supports tabling which makes it decideable for propositional logic. dependent types and high-order types are not supported yet. The generation is still in decreasing probability order 2013-01-07 12:50:32 +00:00
kr.angelov 0be179d7ff bugfix in the strings library from the C runtime 2012-12-27 21:18:46 +00:00
hallgren 368cd7ffbe 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 793ba98249 added alltenses to the default search path (just like prelude) 2012-12-20 16:05:34 +00:00
hallgren fa6f8f49ce PGFService.hs: code duplication reduction 2012-12-20 00:15:18 +00:00
hallgren f73825ddf1 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 4aa3638549 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
kr.angelov bb077b8330 bugfix: the linearizer should not generate extra space at the end of the sentence 2012-12-19 11:18:34 +00:00
kr.angelov f7eaa8a89a bugfix for linearization of metavariables at the root of a tree 2012-12-19 10:03:05 +00:00
kr.angelov 6201640d7b rename linearize.{h/c} to linearizer.{h/c} which follows the convention used in parser.c and reasoner.c 2012-12-19 09:17:24 +00:00
kr.angelov 5c9ee467a9 a major reimplementation of the linearizer in the C runtime 2012-12-19 09:07:05 +00:00
kr.angelov 008c18a8a7 fixed accidental bug in pgf-parse.c 2012-12-18 15:42:04 +00:00
hallgren 3755ea673a partial evaluator bug fix
Int was missing from the list of predefined canonical constants.
2012-12-18 13:03:20 +00:00
kr.angelov dc809da91f the C runtime now can read abstract expressions with literals and meta variables 2012-12-18 12:29:30 +00:00
kr.angelov 32905c8363 debugging infrastructure in the reasoner 2012-12-14 21:25:00 +00:00
kr.angelov 5cec2d5a50 bugfix for the reasoner in the C runtime 2012-12-14 21:24:17 +00:00
kr.angelov b367dfd80f a bit more flexible API for parsing in Python 2012-12-14 16:00:52 +00:00
kr.angelov 8aefd1e072 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 79711380a2 Add language extension for ghc<7.4
FlexibleInstances does not imply TypeSynonymInstances, apparently.
2012-12-14 14:21:46 +00:00
hallgren 950832dbba 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
kr.angelov e1bab39458 bugfix in the lexer from the C runtime. the input sentence doesn't have to terminate with whitespace 2012-12-13 16:45:44 +00:00
kr.angelov 6bc32db1c3 added simple error handling in the Python test 2012-12-13 16:44:39 +00:00
kr.angelov 81428c768c added a simple test for the Python binding 2012-12-13 16:19:56 +00:00
kr.angelov cc7ea9260b an initial API for parsing and linearization from Python 2012-12-13 15:39:07 +00:00
kr.angelov 2ba632dc9f a top-level API for parsing in the C runtime 2012-12-13 14:44:33 +00:00
kr.angelov 60942c440a bugfix: the outside probability of a PgfItemConts must always be initialized to zero 2012-12-13 11:11:45 +00:00
kr.angelov fe51a7fb98 bugfix: pgf_read_expr no longer requires a semicolon at the end of an abstract expression 2012-12-13 11:09:26 +00:00
kr.angelov 162fd5e512 an initial Python binding to the C runtime 2012-12-12 11:29:39 +00:00
kr.angelov 1376df457d started an official API to the C runtime 2012-12-12 11:25:58 +00:00
hallgren f39466f787 partial evaluator work
* 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-11 15:37:41 +00:00
john.j.camilleri 60f8a6b647 Syntax editor: unwrap feature 2012-12-11 15:09:16 +00:00