Commit Graph
100 Commits
Author SHA1 Message Date
hallgren 12d86604b2 Fix Issue 68: Cannot use an overloaded operator in table defined using square brackets
Add proper type checking of course-of-values tables:

 + Make sure that all subterms have the same type.
 + Resolve overloaded operators.

Note though that the GF book states in C.4.12 that the "course-of-values
table [...] format is not recommended for GF source code, since the
ordering of parameter values is not specified and therefore a
compiler-internal decision."
2013-11-12 13:55:38 +00:00
hallgren a3de4b6e86 GF.System.Chatch: remove redundant #include 2013-11-12 13:51:11 +00:00
hallgren 2da15f558e Fix Issue 41: "," in context-free rules causes parsing failure
The CF parser in GF.Grammar.CF assigns function names to the rules, but they
are not always unique, causing rules to be dropped in the follwing CF->GF
conversion. So a pass has been added before the CF->GF conversion, to make
sure that function names are unique.

A comment says "rules have an amazingly easy parser", but the parser looks
like quick hack. It is very sloppy and silently ignores many errors, e.g.
- Explicitly given function names should end with '.', but if the do not, the
  last character in the function name is silently dropped.
- Everything following a ';' is silently dropped.
2013-11-11 16:50:43 +00:00
hallgren d1314dcbcd Fix issue 61: GF shell cannot parse a system command ending with a space
Trailing spaces caused the command line parse to be ambiguous, and
ambiguous parses were rejected by function readCommandLine, causing
the cryptic error message "command not parsed".
2013-11-11 15:13:24 +00:00
hallgren 09e64e92e4 minibar: fix a mistake the previous bracket fix 2013-11-06 16:54:21 +00:00
hallgren dcbe3533d0 minibar: adapt to changed bracket structure in linearization output 2013-11-06 16:45:24 +00:00
hallgren 5beded9330 Make PGF.Tree internal
The only use of PGF.Tree outside the PGF library was in GF.Command.Commands,
and it was eliminated by using PGF.Expr directly instead.
PGF.Paraphrase still uses PGF.Tree.
2013-11-06 14:29:17 +00:00
hallgren 06453afb1c Remove PGF.Signature
This module should not be part of the public PGF library API, and it was only
used in GF.CompileToAPI, so the code was moved there. The module defined
constFuncs and syntaxFuncs, but only syntaxFuncs was used.
2013-11-06 13:27:29 +00:00
hallgren decd7122de Eliminate mutual dependencies between the GF compiler and the PGF library
+ References to modules under src/compiler have been eliminated from the PGF
  library (under src/runtime/haskell). Only two functions had to be moved (from
  GF.Data.Utilities to PGF.Utilities) to make this possible, other apparent
  dependencies turned out to be vacuous.

+ In gf.cabal, the GF executable no longer directly depends on the PGF library
  source directory, but only on the exposed library modules. This means that
  there is less duplication in gf.cabal and that the 30 modules in the
  PGF library will no longer be compiled twice while building GF.

  To make this possible, additional PGF library modules have been exposed, even
  though they should probably be considered for internal use only. They could
  be collected in a PGF.Internal module, or marked as "unstable", to make
  this explicit.

+ Also, by using the -fwarn-unused-imports flag, ~220 redundant imports were
  found and removed, reducing the total number of imports by ~15%.
2013-11-05 13:11:10 +00:00
hallgren e7073de883 Restore ExtraFre to AllFre
ExtraFre was removed from AllFre yesterday for some reason, but it is needed
to compile PhrasebookFre, so I restored it.
2013-11-01 16:30:22 +00:00
hallgren d7300ba9fb Add a cabal flag to use the standard binary package
The standard binary package has improved efficiency and error handling [1], so
in the long run we should consider switching to it. At the moment, using it is
possible but not recommended, since it results in incomatible PGF files.

The modified modules from the binary package have been moved from
src/runtime/haskell to src/binary.

[1] http://lennartkolmodin.blogspot.se/2013/03/binary-07.html
2013-10-31 15:43:12 +00:00
hallgren 9b399a1138 GF home page: comment out news from 2012-11 and older 2013-10-30 13:52:42 +00:00
hallgren acb0b5611e release-next.t2t: add your notes for the next release of GF here
The file will be renamed when the release is made.
2013-10-30 13:44:10 +00:00
hallgren ad0e67530b Functions merge trees into tries in the GF Shell and the PGF web service
* In the shell, the new command tt (to_trie) merges a list of trees into a
  trie and prints it in a readable way, where unique subtrees are marked with
  a "*" and alternative subtrees are marked with numbers.
* In the PGF web service, adding the parameter trie=yes to the parse and
  translate commands augments the JSON output with a trie.

Example to try in the shell:

	Phrasebook> p -lang=Eng "your son waits for you" | tt
2013-10-24 17:29:02 +00:00
hallgren 1fcae658ac Commands.hs: fix a copy-paste error in the documentation of put_tree 2013-10-24 14:32:11 +00:00
hallgren 5dec00c1d1 GF home page: update PGF library API link
GF 3.5 is now on Hackage and the automatic generation of Haddock documentation
succeeded for the first time in a long time!
2013-10-23 14:24:04 +00:00
hallgren 452164f10f GF home page: minor style changes
+ Split the list of languages into several columns if space permits
  (in supported browsers, currently Firefox).
+ Limit the size of the GF logo to 75% of width the window. Looks better on
  small screens.
2013-09-29 16:25:16 +00:00
hallgren 9be39dd3c7 Link to GF source code browser
And the summers chool and the Interactive map are not new anymore.
2013-09-23 13:07:24 +00:00
hallgren a7469a694b Comment out identifier refreshing code only used by the removed refresh pass 2013-09-20 16:36:24 +00:00
hallgren fd430a40fe Introduce type RawIdent; only 9 imports of Data.ByteString.Char8 remain
The fact that identifiers are represented as ByteStrings is now an internal
implentation detail in module GF.Infra.Ident. Conversion between ByteString
and identifiers is only needed in the lexer and the Binary instances.
2013-09-19 20:48:10 +00:00
hallgren 38fe30c610 Make Ident abstract; imports of Data.ByteString.Char8 down from 29 to 16 modules
Most of the explicit uses of ByteStrings were eliminated by using identS,

	identS = identC . BS.pack 

which was found in GF.Grammar.CF and moved to GF.Infra.Ident. The function

	prefixIdent :: String -> Ident -> Ident

allowed one additional import of ByteString to be eliminated. The functions

	isArgIdent :: Ident -> Bool
	getArgIndex :: Ident -> Maybe Int

were needed to eliminate explicit pattern matching on Ident from two modules.
2013-09-19 18:23:47 +00:00
hallgren 9db040e0da Some code verbosity reduction 2013-09-10 14:19:11 +00:00
hallgren 51574b96ea 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 72fd7e821f 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 1846e6bf65 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 f1386b3400 partial evaluator: prettier complaint about nonlinears patterns 2013-09-09 16:23:01 +00:00
hallgren 8479d06f4b partial evaluator: complain about nonlinear patterns 2013-09-09 15:53:14 +00:00
hallgren 7afdc2e139 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 6d0c8eaa34 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
hallgren c6fbe3d23f gf.cabal: version: 3.5-darcs 2013-09-02 20:27:47 +00:00
hallgren fa1f750870 Demo page: added a link to Phrasomatic 2013-08-22 19:27:33 +00:00
hallgren 142b07ca82 gfse: don't use multiline text boxes everywhere, just for concrete syntax 2013-08-21 14:19:05 +00:00
hallgren c959d041a1 gf -server: fix for directory URLs without a trailing slash
When a browser requests a URL that refers to a directory, web server usually
redirect the browser to the same URL with a trailing '/' added, if one was not
already present. This is to prevent relative links in the returned document
from being interpreted relative to the parent directory instead of the current
document. This type of redirection was missing in gf -server.
2013-08-20 15:38:26 +00:00
hallgren f4760b2970 download page: link to Inari's notes on installing GF on windows 2013-08-20 08:09:58 +00:00
hallgren 043ab3e07a gfse: only try to upload/compile grammars when browser is online
Show error message "Offline" if browser is offline.
2013-08-19 15:00:55 +00:00
hallgren 15d52dd5c4 gfse: always open a resizable text box when editing concrete syntax
(Also fixed a broken link in gf-web-api-examples.html)
2013-08-19 14:19:18 +00:00
hallgren 9ffc434fef doc/gf-developers.t2t: add some notes on how to create .deb and .rpm packages 2013-08-08 12:51:24 +00:00
hallgren c012fdc4a9 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
hallgren c836e04764 Update to version 3.5 in gf.cabal and debian/changelog 2013-08-06 15:42:57 +00:00
hallgren db9e12340d Move GF 3.5 download page into place. Update home page. 2013-08-06 15:32:20 +00:00
hallgren fabf992813 Finalize GF 3.4 download page and release notes 2013-08-06 15:28:53 +00:00
hallgren ff33f66fba Next release will be GF 3.5, release notes moved to download/release-3.5.t2t.
Some more work on the 3.5 release notes and download page.
2013-08-05 12:38:38 +00:00
hallgren 5c4dbe743e Update shell reference manual 2013-08-05 11:47:17 +00:00
hallgren fb61fc4562 Cloud & PGF service: use Content-Type application/json for JSON output
This is in accordance with RFC 4627. http://tools.ietf.org/html/rfc4627
Use application/javascript for JSONP output.
2013-07-29 16:05:54 +00:00
hallgren ee81cd5c02 Adding download page and release notes for the next release of GF
The suggested next release is 3.4.8 in early August.
Feel free to add things in download/release-3.4.8.t2t.
2013-07-29 13:26:22 +00:00
hallgren f4519dda8c minibar: more robust test for availability localStorage
Minibar should now work if localStorage is disabled or unavailable.
(In Firefox, disabling cookies also disables localStorage.)
2013-07-29 11:58:17 +00:00
hallgren eb2b5a65d6 Allow cross origin requests to GF cloud & PGF services
By adding a header

	Access-Control-Allow-Origin: *

to the HTTP responses, web browsers are informed that it is OK to call the
services from web pages hosted on other sites.

This is apparently supported in most modern browsers, so it should no longer
be necessary to resort to JSONP.

See https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS
2013-07-25 16:04:43 +00:00
hallgren 656f934945 gf-server.cabal: same changes as in gf.cabal for ghc-7.6 compatibility 2013-07-15 17:07:51 +00:00
hallgren 550db69caa Fix UTF-8 decoding problem in gf -server
The package network-2.4.1.1 thoughlessly introduced a backward incompatible
change to the function Network.URI.unEscapeString, see

    https://github.com/haskell/network/commit/f2168b1f8978b4ad9c504e545755f0795ac869ce

This also affects the function Network.Shed.Httpd.queryToArguments, which is
used in GFServer.hs.

To remain compatible with older and newer versions of the network package,
we need to stay clear of queryToArguments and unEscapeString. A replacement
function has been added to server/URLEncoding.hs.
2013-06-13 08:23:48 +00:00
hallgren 860b25fff3 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 4e2337f009 GF.Text.Transliterations: avoid error prone function Data.Map.fromAscList 2013-06-02 10:10:46 +00:00
hallgren 6ca2fe5898 Demo page: add a version of the minibar that shows just the MOLTO Application grammars 2013-05-24 14:20:36 +00:00
hallgren 5d7658c081 Download page: the .deb packages also work on Ubuntu 13.04 2013-05-03 13:14:27 +00:00
hallgren 0dbddbb9d7 Setup.hs: comment out ineffective parallelisation 2013-05-02 12:36:16 +00:00
hallgren d2627125e6 Download page & developers guide: add a section about known problems with Cabal 2013-04-29 13:12:37 +00:00
hallgren 3d984e9ee4 gfse: use alltenses/ instead of present/ when looking up RGL oper types 2013-04-26 15:01:11 +00:00
hallgren 46546a3e93 Add greek to Setup.hs and the web apps 2013-04-26 13:42:01 +00:00
hallgren 56f87a4c34 minibar: remove two more uses of with() 2013-04-25 15:08:26 +00:00
hallgren debe305484 minibar: fix bug that prevented minibar from working in Webkit browsers
The with(...) {...} statement has different scoping rules in Webkit browsers
and Gecko browsers, so it is better to avoid it.
2013-04-25 14:55:24 +00:00
hallgren 74ea0c9cf4 PGF service: apply the token binding operator &+ to all linearizations
The &+ operator is now consistently eliminated from the output of commmands
that produce linearizations. Before, only the commands translate and
translategroup did this.
2013-04-24 18:32:53 +00:00
hallgren 322968fb5c js/localstorage.js: don't throw an exception if JSON parsing fails
Return the given default value instead.
2013-04-23 14:14:38 +00:00
hallgren 5c19681f2d gfse: add access to the syntax editor
via the minibar
2013-04-23 13:55:00 +00:00
hallgren dade5c1194 js/gfrobust.js: don't try to translate sentenses that are too long
The C run-time responds badly to input that is too long, so we return an
error message here instead.
The limit is 200 URL-encoded characters.
2013-04-23 13:40:38 +00:00
hallgren d6c01c5414 js/localstorage.js: improved faked localStorage if real localStorage is missing 2013-04-23 12:44:12 +00:00
hallgren aa37d9d01b minibar: use the common interface to localStorage
...for more streamlined code and better browser compatibility.
2013-04-23 12:39:18 +00:00
hallgren 7c24e41d54 gfse: don't add --# -path=.:present
Nowadays GF includes alltenses by default in the grammar search path.
2013-04-20 07:25:38 +00:00
hallgren 57e06e7a6a simple translation tool: minor documentation fix 2013-04-19 14:10:03 +00:00
hallgren 5a9c370cdf gf-cloud-api.html: fixed a typo
in the documentation of command=remake.
2013-04-19 12:17:27 +00:00
hallgren 18f862abbc gf-cloud-api.html: clarification
Unrecoginzed parameter in cloud service requests are silently ignored.
2013-04-19 12:06:00 +00:00
hallgren f4a7893e15 simple translator: improved translation with the GF robust parser
by separate punctuation from the string sent to the robust parser.
Also added buttons to view parse trees from the robust parser.
2013-04-18 13:11:46 +00:00
hallgren deb0227168 gfrobust.js: add a method for constructing parse tree image URLs. 2013-04-18 13:11:05 +00:00
hallgren 12d1bbda48 GF home page: add "machine translation" in a meta keywords tag
GF does not show up if you google for machine translation. This meta tag might
help, but in general I think it is better for SEO to mention relevant keyword
in the body text than to rely on meta tags.
2013-04-18 12:02:32 +00:00
hallgren c1390db368 minibar: syntax editor integration bug fix
The minibar has the alternative "All" in the target language menu. This should
not be included when transfering to the syntax editor.
2013-04-17 08:49:31 +00:00
hallgren 5e15ba20f5 minibar: fixes for phrasebook
Add minibar option to_multiple to be able to turn off selection of multiple
target languages.
2013-04-17 08:39:39 +00:00
hallgren 4ec1db9065 GF cloud: work on syntax editor integration
+ The syntax editor is now accessible from the Simple Translaton Tool.
+ The minibar now automatically provides access to the syntax editor (provided
  the necessary JavaScript files and style sheets have been loaded).
+ Preparations for making the syntax editor accessible from the grammar editor.
2013-04-12 18:29:15 +00:00
hallgren 041d8f1a2d syntax editor: fix references to global object 'server' 2013-04-12 17:50:44 +00:00
hallgren 95e68117a9 minibar/syntax editor integration fixes
When starting from the minibar, the selected set of target languages is now
preserved when switching back and forth.
2013-04-12 14:30:27 +00:00
hallgren 965adf74d6 Simple Translation Tool: eliminate &+ in translations from GF
Also fixed a bug introduced in previous refactoring.
2013-04-12 13:00:05 +00:00
hallgren 3cebd68a78 gfrobust.js: adding a JavaScript API to the GF Robust Parser translation service
Factored out from the Simple Translation Tool.
2013-04-12 12:47:13 +00:00
hallgren a60e8bb0b7 minibar.html: add debug element
to allow debug output from the syntax editor when it is started from the
minibar.
Also fix broken markup.
2013-04-11 11:47:06 +00:00
hallgren 1ad1d427a4 Import Folkets Lexikon: report the number of words found
And some other minor tweaks.
2013-04-11 08:54:39 +00:00
hallgren 2d3e242ab3 gf -s/-q now silences "no linearization of" warnings 2013-04-10 23:00:01 +00:00
hallgren 523d7139f4 Import of Folkets Lexikon: the heap size limit was too low for 64-bit systems
The default heap size limit has been increased to 3GB. On 32-bit system you
can use a lower limit:

	make M=1500M
2013-04-10 16:42:35 +00:00
hallgren 6689677165 Adding a script to import Folkets Lexikon
In order to compile DictEngSwe.gf, you must now first run this script to create
FolketsLexikon.gf.

	cd lib/src/swedish/folketslexikon
	make

This will automatically download and convert Folkets Lexikon.
If the download fails, a dummy version of FolketsLexikon.gf will remain,
allowing DictEngSwe.gf to be compiled anyway.
2013-04-10 16:25:48 +00:00
hallgren 0667311adf 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 98d068fa3a minibar: add a visual hint that linearizations can be expanded into tables 2013-04-07 12:06:12 +00:00
hallgren 44a83cf04a Compiler.hs: ghc 7.6.2 compatibility 2013-04-05 20:37:37 +00:00
hallgren 0cb376f813 Simple Translator: add GF Robust Parser to the menu for individual segments 2013-04-05 20:32:20 +00:00
hallgren f67699398e Simple Translator: use lextext/unlextext for translations with the robust parser 2013-04-05 15:15:40 +00:00
hallgren e6286fd376 Simple Translator: initial support for translation with the GF robust parser 2013-04-05 13:25:09 +00:00
hallgren 8a1b37a169 minibar/syntax editor integration improvements
Work in progress on preserving the start category and selected target languages
when switching between the minibar and the syntax editor.
2013-04-04 14:04:31 +00:00
hallgren d10c6bc85f Simple Translation Tool: initial support for editing source segments in the minibar 2013-04-03 20:24:57 +00:00
hallgren 0b03908ba8 Adding src/www/js/localstorage.js
A common interface to localStorage, to store JSON data under a unique prefix.
2013-04-03 20:23:32 +00:00
hallgren 56a299df79 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
hallgren c457cfe305 gf.cabal: fix tab char problem 2013-04-02 14:53:15 +00:00
hallgren 84c197106b gf.cabal: gf depends on utf8-string even when compiled without server support 2013-04-02 14:50:01 +00:00
hallgren 40bc49245a minibar: remember the selected set of target langauges 2013-04-02 13:49:50 +00:00
hallgren da862e20b4 minibar: abstract syntax trees are now shown with or without category names
Function names are always shown.
2013-04-02 11:56:10 +00:00
hallgren 0e45b8513f minibar: show abstract syntax trees without or with function names
Click once to show abstract syntax trees without function names. Click again
to add function names.
2013-03-28 16:00:04 +00:00
hallgren 525b983b4c PGF web API: command=abstrtree not supports the nocat and nofun options 2013-03-28 15:57:17 +00:00