Commit Graph
100 Commits
Author SHA1 Message Date
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
hallgren d0b60f5458 Wide coverage translation demo: updated to use App15.pgf 2015-11-27 09:56:49 +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 ea540c118c gf.cabal: require base>=4.5 (ghc>=7.4)
There are some low-level dependencies in GF.Text.Coding that break
compatibility with older versions of GHC and some other known problems.
2015-10-07 14:57:01 +00:00
hallgren ec31efccc6 Update PGF API documentation link on home page, bump version number in gf.cabal to 3.7.1-darcs 2015-10-05 12:38:23 +00:00
hallgren 5469706080 Setup.hs: fix off-by-one error the change count in the version info
The difference between "One change" and "No changes" is very noticeable.
2015-10-02 11:46:29 +00:00
hallgren 74d8e9c6cf Bump version number to 3.7.1 and finalize documentation
Updated version number in gf.cabal and update debian/changelog
News item on home page (index.html)
Some last minute edits on the download page
Move the new release notes and download page in place.
2015-10-02 10:15:02 +00:00
hallgren 1e88cf380a GF.Interactive2: extension FlexibleContexts is needed for GHC 7.10 compatibility 2015-10-02 09:59:55 +00:00
hallgren a6d95d6272 Minor edit of GF 3.7.1 release notes 2015-10-02 09:34:20 +00:00
hallgren 33e4f4eefc Some work on the release notes and download page for GF 3.7.1. 2015-10-01 12:57:31 +00:00
hallgren 0a7e8e7b5d bin/build-binary-dist.sh: fix hardcoded /usr install path for .pkg packages. 2015-10-01 12:49:55 +00:00
hallgren d0d1bc6be4 Makefile: make pkg: change install location from /usr to /usr/local
...for compatibility with OS X 10.11 El Capitan (which was released yesterday)
2015-10-01 08:39:35 +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 050c63f31e download/release-next.t2t: preliminary release notes for GF 3.7.1
To be released as soon as possible...
2015-09-29 20:15:51 +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 cf959444a2 haskell-bind/SG.hsc: fix unsafePerformIO import problem with ghc>=7.8 2015-09-14 11:42:42 +00:00
hallgren b717031cbf doc/gf-developers.t2t: script name for installing the C run-time was wrong, should be setup.sh 2015-09-14 11:19:29 +00:00
hallgren a3dcc2ff0e doc/gf-developers.t2t: some updates 2015-09-14 09:24:10 +00:00
hallgren 03d1066a1c WebSetup.hs: always enable parallel compilation of the RGL and the example grammars
This should work nicely now that GF itself can detect the number of processors
in the system.

Previously there was some code in WebSetup.hs that relied on Cabal to do this,
but it was commented out because it requires Cabal>=1.20, which is fairly new
and it would complicate the installation instructions if it was required to
compile GF...
2015-09-11 15:15:53 +00:00
hallgren 6aa4a7b737 Remove debug output introduced in previous patch
Oops.
2015-09-11 14:46:31 +00:00
hallgren 264fd05444 Parallel compilation: "gf -make -j" and "gf -make -j=n" now work as expected
* "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-11 14:18:01 +00:00
hallgren a976a49cef PGF2.Expr: a fix for ghc-7.6
Apparently Foreign.unsafePerformIO is not just a re-export of
System.IO.Unsafe.unsafePerformIO (or vise versa), it is a different function,
so you get an ambiguity if you import both.
2015-09-10 15:07:48 +00:00
hallgren 6b285d215c example/foods/FoodsIce.gf: converted from Latin-1 to UTF-8 encoding 2015-09-10 12:37:12 +00:00
hallgren 81a99fc8ed GF shell: write_file now writes one tree per line
This compensates for other changes that removed line breaks.
Maybe it should have a -lines options like ps and rf?
2015-09-03 20:42:38 +00:00
hallgren dab749a956 PGF2.Expr fixes
It needs to be listed in gf.cabal
unsafePerformIO is only exported from System.IO.Unsafe, starting with ghc-7.8
2015-09-03 20:41:00 +00:00
hallgren cc1ec66e2e Wide coverage translation demo: make it easier to use with different grammars 2015-09-02 14:44:30 +00:00
hallgren e76fb3d9a1 GF.Infra.SIO: The SIO monad now supports putStr in addition to putStrLn
Also included some unrelated minor changes.
2015-08-31 12:22:13 +00:00
hallgren f62edb3e1e Comment out some dead code found with -fwarn-unused-binds
Also fixed some warnings and tightened some imports
2015-08-28 13:59:43 +00:00
hallgren 38ce5826a8 GF shell: change parse & linearize to obtain useful results from p|l and l|p 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-26 13:56:23 +00:00
hallgren 72459b5158 lib/src/*/Numeral*.gf: fix inconsistent inheritance form Cat
While the abstract Numeral inherits only Cat[Numeral,Digits], some of the
concrete NumeralNNN of Numeral inherited everything from CatNNN.

Normally the compiler outputs a warning message when a concrete syntax 
contains superflous lincats, but apparently not when they get included
through inheritance...

This does not seem to cause problems in the Haskell run-time system, but the 
C run-time system fails to load PGFs with superflous lincats.

This problems shows up when creating application grammars that inherit Numeral.
The Phrasebook is an example of such a grammar.
2015-08-26 11:53:16 +00:00
hallgren 09f3937da1 GF shell bug fix: visualize_parse didn't accept the -lang flag
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-21 12:20:40 +00:00
hallgren 672d83f41f GF -cshell: implement visualize_parse
Supported options and flags: -lang -format -view
None of the rendering options available in the Haskell run-time are supported.
2015-08-21 12:14:47 +00:00
hallgren bf0d75002a gf -cshell: implement visualize_tree
But the following options are not supported: -mk -nocats -nofuns
2015-08-21 10:14:46 +00:00
hallgren 9efa45b80b gf -cshell: implement a subset of print_grammar and abstract_info
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-20 16:06:10 +00:00
hallgren d2217c0715 PGF2: export BindType(..) and two new functions: showType & categories
showType :: Type -> String
categories :: PGF -> [Cat]

But both are implemented as quick hacks: categories is implemented by listing
all functions and taking the target categories from their types. showType uses
ppType copied & modified from PGF.Type, and needs a ppExpr, which is currently
implemented by wrapping showExpr...

TODO: need something correpsonding to PGF.categoryContext.
2015-08-20 15:55:24 +00:00
hallgren 5f3417ec5e gf -cshell: linearize: implement options -all -list -treebank
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-18 16:05:45 +00:00
hallgren d1cf9d734e GF shell: restore the eh command to working order and document it
Also, when the command line parser fails, append the problematic command line
to the error message "command not parsed".
2015-08-18 13:13:31 +00:00
hallgren d039147261 GF shell: add the start options to GFEnv, turn "reload" into an ordinary command 2015-08-17 15:56:39 +00:00
hallgren a3db215f5b GF Shell: "ph | wf -file=foo.gfs" now works as advertised
The print_history command was among the commands implemented in an ad-hoc
way instead of being handled by the command line interpreter, which means
it could not be used in a pipe, as in the example in the help info.
The refactoring in the previous patch made this old bug easy to fix.

Also fixed a bug in the "empty" command, introduced when moving the PGF from
CommandEnv to GFEnv.

TODO: fix the undocumented eh command. A comment in the help info for
print_history, and some commented out old code, suggest that eh means
"execute_history", but at present it does nothing...
2015-08-13 15:30:23 +00:00
hallgren 5339c1e6b5 GF Shell: refactoring for improved modularity and reusability:
+ Generalize the CommandInfo type by parameterizing it on the monad
  instead of just the environment.
+ Generalize the commands defined in
  GF.Command.{Commands,Commands2,CommonCommands,SourceCommands,HelpCommand}
  to work in any monad that supports the needed operations.
+ Liberate GF.Command.Interpreter from the IO monad.
  Also, move the current PGF from CommandEnv to GFEnv in
  GF.Interactive, making the command interpreter even more generic.
+ Use a state monad to maintain the state of the interpreter in
  GF.{Interactive,Interactive2}.
2015-08-13 10:49:50 +00:00
hallgren 5c6adb1927 GF Shell: turn set_encoding into a common command
Implemented in GF.Command.CommonCommands instead of GF.Interactive &
GF.Interactive2.
2015-08-12 15:00:03 +00:00
hallgren 2f3b6779c6 GF.Interactive2: cleanup 2015-08-12 12:33:36 +00:00
hallgren 721f653e99 GF shell: source commands (cc, sd, so, ss & dg) can now be used in pipes
These commands are now implemented as regular commands (i.e. using the
CommandInfo data type) in the new module GF.Command.SourceCommands.

The list of commands exported from GF.Command.Commmands now called pgfCommands
instead of allCommands.

The list allCommands of all commands is now assembled
from sourceCommands, pgfCommands, commonCommands and helpCommand in
GF.Interactive.
2015-08-12 11:05:08 +00:00
hallgren ba9c057650 Move welcome message from GF.Interactive & GF.Interactive2 to GF.Command.Messages
...to avoid the duplication.
2015-08-12 11:01:45 +00:00
hallgren 07fd298700 GF shell: make environment types abstract, comment out some dead code 2015-08-11 16:14:38 +00:00
hallgren 624de05fe3 gf -cshell: improved help for the 'import' command 2015-08-10 16:39:31 +00:00
hallgren 6e5d8cebe0 Forgot to include gf.cabal in previous patch 2015-08-10 16:38:28 +00:00
hallgren f371a020f9 Factor out common code from GF.Command.Commands and GF.Command.Commands2
Created module GF.Command.CommonCommands with ~250 lines of code for commands
that do not depend on the type of PGF in the environemnt, either because they
don't use the PGF or because they are just documented here and implemented
elsewhere.

TODO: further refactoring so that documentation and implementation of
*all* commands can be kept together.
2015-08-10 16:30:17 +00:00
hallgren 230d9780b7 gf -cshell: preliminary support for the C run-time system in the GF shell
Some C run-time functionality is now available in the GF shell, by starting
GF with 'gf -cshell' or 'gf -crun'. Only limited functionality is available
when running the shell in these modes:

- You can only import .pgf files, not source files.
- The -retain flag can not be used and the commands that require it to work
  are not available.
- Only 18 of the 40 commands available in the usual shell have been
  implemented. The 'linearize' and 'parse' commands are the only ones
  that call the C run-time system, and they support only a limited set of
  options and flags. Use the 'help' commmands for details.
- A new command 'generate_all', that calls PGF2.generateAll, has been added.
  Unfortuntaly, using it causes 'segmentation fault'.

This is implemented by adding two new modules: GF.Command.Commands2 and
GF.Interactive2. They are copied and modified versions of GF.Command.Commands
and GF.Interactive, respectively. Code for unimplemented commands and other
code that has not been adapted to the C run-time system has been left in
place, but commented out, pending further work.
2015-08-10 14:12:51 +00:00
hallgren 97c6ffd462 Refactor GF shell modules to improve modularity and reusability
+ Move type CommandInfo from GF.Command.Commands to a new module
  GF.Commands.CommandInfo and make it independent of the PGF type.
+ Make the module GF.Command.Interpreter independent of the PGF type and
  eliminate the import of GF.Command.Commands.
+ Move the implementation of the "help" command to its own module
  GF.Command.Help
2015-08-10 13:01:02 +00:00
hallgren 1dcad033b7 GF Home Page: Updated the link to the Haskell API, and a couple of other links 2015-08-06 14:07:18 +00:00
hallgren a7945644e8 Update doc/gf-help-full.txt (GF shell reference manual) 2015-08-04 11:49:17 +00:00
hallgren e5046b7e6d FoodsTur.gf: use Predef.BIND instead of "&+"
...for better results when used with the C run-time system.
2015-07-28 10:58:00 +00:00
hallgren 495f64db21 Setup.hs: ignore .* instead of . and .. when compiling/copying all files in a directory
This avoids problems with .DS_Store files created by the Finder on OS X.
2015-07-22 14:34:02 +00:00
hallgren b0a4dfeddd translator/DictionarySwe.gf: change fetch_V2 from "dra ut" to "hämta" 2015-07-21 15:06:04 +00:00
hallgren 2fe31eca17 PGF web service: option to leave &+ uninterpreted in linearized output
By adding unlexer=none (or unlexer=id) in requests that output linearizations
(e.g. command=linearize, command=translate), you can leave &+ uninterpreted
instead of gluing the adjacent tokens. This means that the output is left in
a format that can be parsed in a subsequent request.

To implement this consistently, the function linearizeAndBind was replaced
with the function linearizedAndUnlex (but there are a couple of requests
that do not call this function...)

Note that this applies to the Haskell run-time requests only. The C run-time
request (c-linearize, c-translate) always applies the &+ token and the
c-parse request can parse input containing glued tokens.
2015-07-21 14:21:49 +00:00
hallgren e4525d1565 translator/DictionarySwe.gf: film_V and shock_V2. 2015-07-20 14:45:58 +00:00
hallgren 47f7cf640d translator/DictionarySwe.gf: 38 new words
Also added wince_V in Dictionary.gf and DictionaryEng.gf
2015-07-20 14:23:46 +00:00
hallgren 0695fecad6 Setup.hs: correctly parse output from 'darcs changes' for newer versions of darcs
It worked with darcs-2.8 before, now it also works with darcs-2.10.
2015-07-20 13:02:49 +00:00
hallgren 6e93b3bd34 translator/DictionarySwe.gf: 26 new words and fixes 2015-07-16 13:11:15 +00:00
hallgren c14ca1eba4 Wide Coverage Demo: avoid errors if d3 or d3Tree can't be loaded 2015-07-15 14:07:26 +00:00
hallgren 47dbfdb831 translator/DictionarySwe.gf: called_A, injured_A, shocked_A & shoddy_N 2015-07-01 08:23:10 +00:00
hallgren 6fc3114e3e translator/DictionarySwe.gf: combined_A, combining_N & sleek_A 2015-06-29 14:01:47 +00:00
hallgren 03d3814501 Remove left over [...] from release notes, bump version number in gf.cabal to 3.7-darcs 2015-06-25 14:56:15 +00:00
hallgren f77fba354e Update home page, download page & release notes for GF 3.7. Bump version number in gf.cabal 2015-06-25 12:22:06 +00:00
hallgren 4e9e7c2bdd Documentation updates for the release of GF 3.7 2015-06-25 12:10:47 +00:00
hallgren 71c037b4df runtime/c/pf/jit.c: silence warning about alloca on MINGW32 2015-06-23 15:49:31 +00:00
hallgren 5390f6a862 Bump version of .gfo and .pgf files, improve error messages on version mismatch
Becacuse of the new special tokens added to the Symbol type, .gfo and .pgf
files produced with the current version of GF can not always be used with
older versions of GF and the PGF run-time system.

The PGF version number was increased from (2,0) to (2,1). GF can still
read version (2,0) and (1,0), so old PGF files continue to work.

The GFO version was increased from "GF03" to "GF04".
2015-06-23 12:58:14 +00:00
hallgren 3e4e6d5337 WebSetup.hs: a note about parallel builds 2015-06-23 10:22:35 +00:00
hallgren 287be6ff2d doc/gf-developers.t2t: add a note about parallel builds
Also added a note that partial builds (cabal build rgl-none, etc) doesn't work
with newer versions of cabal.
2015-06-23 10:20:04 +00:00
hallgren dbe00ecfac Remove the automatically generated doc/gf-developers.html 2015-06-22 15:10:37 +00:00
hallgren a5cbc648e9 Adding download/release-next.t2t (to be renamed) with preliminary release notes for the next release
You can use 'darcs changes --from-tag=RELEASE-3.6' to get a list of changes
since the previous release and extract noteworthy changes from there.
2015-06-11 13:55:18 +00:00
hallgren a1c5cfb55f translator/DictionarySwe.gf: fix brush_V2 2015-05-27 16:02:47 +00:00
hallgren 7c9e860d87 Wide Coverage Translation Demo: add buttons for speech output
Also fixed a problem with showing inflections for words containing underscores
(e.g. race_2_N).
2015-05-27 13:29:41 +00:00
hallgren d64bb8b83d minibar: moved 2 reusable functions from minibar_translations.js to minibar_support.js 2015-05-27 13:28:40 +00:00
hallgren fc7c285e52 examples/phrasebook/Makefile2: include Jpn and Snd in the build 2015-05-21 15:01:27 +00:00
hallgren 941d6ea0ea Omit -optimize-pgf when compiling small example grammars
The minibar lets the user choose any category as the start category, but this
can lead to run-time errors for grammars compiled with -optimize-pgf.

The problem can also be observed in the GF shell. For example, 
"linearize Fish" (which means that the start category is Kind) fails for 
some languages when Foods.pgf is compiled with -optimize-pgf.
2015-05-21 14:44:20 +00:00
hallgren 602b6fffae Fixed a problem with minibar when invoked from gfse or the syntax editor
Minibar needs js/langcode.js now, so need to include it in gfse/index.html
and syntax-exitor/editor.html too.
2015-05-21 08:00:49 +00:00
hallgren 1173ebc230 minibar: cosmetic fix for the "To:" menu 2015-05-19 14:26:39 +00:00
hallgren 4211511dfb minibar: more work on speech output 2015-05-19 13:38:42 +00:00
hallgren 975b39716a minibar: speech output (experimental) (in browsers that support it) 2015-05-18 15:58:57 +00:00
hallgren a73af40230 minibar: use SVG instead of PNG for trees and alignment diagrams if supported by the browser 2015-05-18 14:54:29 +00:00
hallgren 512fbb49e6 GF cloud: updated lists of supported RGL languages and some minor style updates 2015-05-18 13:16:45 +00:00
hallgren c1c58f9919 translator/DictionarySwe.gf: fixes for landslide_N, mudslide_N and race_2_N 2015-05-07 13:48:51 +00:00
hallgren dfd42bade2 GF.Haskell: small pretty printing improvement 2015-05-05 14:06:20 +00:00
hallgren c13f5a0d68 GF.CompileOne: use random numbers to avoid temporary file name clashes
When using make -j to compile examples/app or examples/phrasebook, since
the dependencies are not completely specified in the Makefiles, it can
happen that the same file is compiled at the same by more than one process,
resulting in an error when they try to write the same .gfo.tmp file. Adding a
random number to the temporary file name avoids this problem.
2015-05-05 13:51:35 +00:00
hallgren 54b69e25ea pgf-shell.hs: remove call to performGC and document the 'i' command 2015-04-17 13:34:41 +00:00
hallgren 409f7ab3e3 gf -server: include grammar modification time in the info returned by /version 2015-04-17 13:21:20 +00:00
hallgren 69a192308b PGF web service: add command c-linearizeAll to obtain all variants
Implemented by calling the recently added function PGF2.linearizeAll.
2015-04-17 12:59:03 +00:00
hallgren 8c27daca37 translator/DictionarySwe.gf: fix hug_V2 2015-04-17 11:33:28 +00:00
hallgren 9495fc309f Wide Coverage Translation Demo: length limit test uses # of source chars now
The length limit test previously used the URL-encoded UTF-8 representation
of the source sentense. This was needed because of a fixed size buffer in C.
Now that the server is in Haskell, the only reason the length is limited
is to avoid excessive time and space use in the parser, so it is better to
count source characters. This also avoids being too restrictive with
non-European languages.
2015-04-16 12:21:32 +00:00
hallgren 3aaeaf1325 Translating linearization functions to Haskell: move Haskell AST and pretty printer to GF.Haskell
For further separation of pretty printing concerns from conversion concerns,
the Haskell AST and pretty printer has been moved to its own module,
GF.Haskell, also allowing it to be reused in other places where Haskell
code is generated.
2015-04-14 12:44:14 +00:00
hallgren 29712a43ac Wide coverage translation demo: show an informative error message for sentences that exceed the length limit 2015-04-09 10:18:41 +00:00
hallgren e2e943eabc GF.Compile.ConcreteToHaskell: some documentation 2015-04-07 14:51:52 +00:00
hallgren 33442e6b4f GF.CompileInParallel: get rid of the cryptic 'thread blocked indefinitely in an MVar operation' message after compilation errors
Instead show a message saying how many modules were affected by the compilation
errors.
2015-03-31 13:26:51 +00:00
hallgren bab4e7f872 translator/DictionarySwe.gf: nordic_A, washing_N 2015-03-31 12:24:54 +00:00
hallgren 4a195c1915 translator/DictionaryTha.gf: fix a syntax error 2015-03-25 14:32:37 +00:00
hallgren d1bca8f4de Wide Coverage Translation Demo: zoomable panable collapsible syntax trees
This is an experimental solution using JavaScript code from
https://github.com/christos-c/tree-viewer, d3js.org and jquery.com.
2015-03-24 18:03:10 +00:00