Commit Graph

2855 Commits

Author SHA1 Message Date
hallgren
87b280fd4f gf -server: introduce command=remake for recompiling previously uploaded grammars
Also remove some old commented out code.
2012-10-23 20:23:01 +00:00
hallgren
7565ba8b87 cleanup
Simplify the implementation of writeUTF8File and use it in one more place.
Remove unused imports left over after a previous change.
2012-10-23 11:48:23 +00:00
hallgren
c70c01745b Add Chinese to the list of installed RGL languages and support it in the web apps
Aarne says the Chinese resource grammar is complete, but not yet completely
correct.
2012-10-22 10:16:10 +00:00
hallgren
d0e1187b10 Refactor compileSourceModule
There was 55 lines of rather repetitive code with calls to 6 compiler passes.
They have been replaced with 19 lines that call the 6 compiler passes
plus 26 lines of helper functions.
2012-10-19 20:14:11 +00:00
hallgren
885aaca6de Consistenly use SourceGrammar instead of [SourceModule] when calling compiler passes 2012-10-19 19:56:00 +00:00
hallgren
1d6cbf8189 Use NOINLINE for build info and darcs version info
... to avoid unnecessary recompilation of other modules.
2012-10-18 20:01:22 +00:00
hallgren
cf44576573 gfse: grammars can now contain one-line descriptions
Also fixed two small problems with public grammars.
2012-10-18 12:48:39 +00:00
hallgren
a74e619c3f gfse: small fix 2012-10-16 23:06:37 +00:00
hallgren
d63d350cef gfse: identify inherited grammars by their unique id
This helps avoiding problems if an inherited grammar is renamed, or if there
is more than one grammar with the same name.
2012-10-16 22:10:49 +00:00
hallgren
eff4d46fba GF.Command.Command: turn CommandOutput into a newtype
The output from commands is represented as ([Expr],String), where the [Expr] is
used when data is piped between commands and the String is used for the final
output. The String can represent the same list of trees as the [Expr] and/or
contain diagnostic information.

Sometimes the data that is piped between commands is not a list of trees, but
e.g. a string or a list of strings. In those cases, functions like fromStrings
and toStrings are used to encode the data as a [Expr].

This patch introduces a newtype for CommandOutput and collects the functions
dealing with command output in one place to make it clearer what is going on.
It also makes it easier to change to a more direct representation of piped
data, and make pipes more "type safe", if desired.
2012-10-16 13:01:03 +00:00
kr.angelov
28b58b6267 add teyjus/simulator/builtins/builtins.h 2012-10-11 11:10:17 +00:00
kr.angelov
f0583bfd93 added the forgoten libteyjus.pc.in file in the C runtime 2012-10-11 04:22:38 +00:00
hallgren
ea4ed8b4db gfse: adding a section about public grammars in about.html 2012-10-09 14:54:50 +00:00
hallgren
02e128d493 gfse: show the grammar list if the currently selected grammar can not be loaded
Avoid showing a blank page if there is an unexpected problem with the grammars
in localStorage.
2012-10-09 13:44:34 +00:00
hallgren
aaae3aecd4 gf -server: /parse command now supports input with character codes > 255
This enables the use of arbitrary Unicode character in text mode in GFSE.
2012-10-09 13:14:18 +00:00
hallgren
28f87140c7 Factor out code for setting the console encoding
Moved similar low-level code blocks in Main and GFI for setting the console
encoding to the new module GF.System.Console.
2012-10-05 12:54:49 +00:00
hallgren
3d47d7b6f9 simple translator: make it usable on iOS devices
To make the popup menus accessible, use a simple trick to activate the
simulate-hovering-by-tapping behaviour.
2012-10-04 22:29:42 +00:00
hallgren
99b0e42e12 simple translator: bug fix
"Edit/Add a segment..." stopped working at some point.
(Importing text still worked.)
2012-10-04 18:02:31 +00:00
hallgren
5e1da255a3 gfse: various code improvements and prelimiary support for public grammars 2012-10-04 15:21:30 +00:00
hallgren
dad8d4a0ea gfse: fix a bug caused by sharing when copying a linearization function in the row view
Functional programming is easier than imperative programming!
2012-10-03 13:54:35 +00:00
hallgren
edc51c6a2f gfse: some refactoring 2012-10-03 13:22:50 +00:00
hallgren
432a354b91 gfse: row view: add a button to copy a linearization
When adding a new function, you can enter a linearization for one language
and then copy it to the other languages with one button click.
2012-10-03 12:37:47 +00:00
hallgren
a64b4a7c79 gfse and cloud service documentation update 2012-10-02 17:32:52 +00:00
hallgren
57a63d2512 gfse: you can now add new functions from the matrix view 2012-10-02 13:50:35 +00:00
hallgren
2925aed17c gfse: more intuitive buttons for switching between the column, matrix & row views 2012-10-02 13:09:56 +00:00
hallgren
5ec3f70224 gfse: adding a "row" view
Accessed by clicking on a function in the Abstract column in the matrix view.
2012-10-01 21:08:09 +00:00
hallgren
00e333dc11 gfse: matrix view improvements
+ You can click on a column header to switch to column view (i.e. the
  corresponding abstract/concrete syntax tab).
+ The categories and functions in the abstract syntax can be edited directly
  in the matrix view.
2012-10-01 16:29:59 +00:00
hallgren
8b1cec5610 gfse: small linearization type display adjustment 2012-09-30 19:53:57 +00:00
hallgren
bd00109cc5 gfse: display "??" instead of "null" in linearization types when lincats are missing 2012-09-30 19:47:30 +00:00
hallgren
3c826315d7 gfse: show the types of linearization functions when hovering over their names 2012-09-30 19:33:25 +00:00
hallgren
fc09b7e604 PGF service & minibar: put a limit on the number of parse trees
+ In the PGF web service API, the commands parse, translate and translategroup
  now accept a limit parameter. It limits the number of parse trees returned.
  If no limit is given, the behaviour is backwards compatible, i.e. no limit
  is applied.
+ In minibar, the limit is now set to 25 by default.

This change is based on a suggestion by Kaarel Kaljurand.
2012-09-30 15:35:25 +00:00
hallgren
253ddde6c3 gfse & cloud improvements
+ Added "Symbolic" to the list of resource modules that can be opened.
+ Clicking on the name of an opened resource module now displays the list
  operations it provides. (Implemented using show_operations in the GF shell.)
+ Added a GF version info link to the cloud service start page.
2012-09-28 14:27:18 +00:00
hallgren
98989e1f20 GF shell, show_operations: nicer looking types for linearization functions
Adding a lock field to the result type of linearization functions.
TODO: figure out how to add a lock field to the argument types too.
2012-09-28 12:38:26 +00:00
hallgren
45094fca23 GF shell, show_operations: also show the types of linearization functions
This is a simple change in GF.Grammar.Lookup.allOpers, which is used only in
the implementation of the show_operations command in the shell.

This is useful when importing a concrete syntax (like LexiconEng) as a resource.
However, the types don't always look as nice as I hoped...
2012-09-27 15:55:20 +00:00
hallgren
2b4182409d SIO bug fix
Line breaks were missing when capturing stdout. (putStrLn acted like putStr.)
2012-09-26 18:13:47 +00:00
hallgren
3bc65ba527 gf -server: add a GF version info request
GF version info can now be obtained from http://localhost:41926/version
Also removed some unused imports.
2012-09-26 15:23:29 +00:00
hallgren
7c65cd4073 Use the SIO monad in the GF shell
+ The restrictions on arbitrary IO when GF is running in restricted mode is now
  enforced in the types.
+ This hopefully also solves an intermittent problem when accessing the GF
  shell through the web API provided by gf -server. This was visible in the
  Simple Translation Tool and probably caused by some low-level bug in the
  GHC IO libraries.
2012-09-25 19:08:33 +00:00
hallgren
ad536c1369 GF.Infra.SIO.hs: adding the SIO monad (where S = Shell or Safe)
The SIO monad is a restriction of the IO monad with two purposes:

+ Access to arbitrary IO operations can be turned off by setting the environment
  variable GF_RESTRICTED. There is a limited set of IO operations that are
  considered safe and always allowed.

+ It allows output to stdout to be captured. This can be used in gf -server
  mode, where output of GF shell commands is made part of HTTP responses
  returned to clients.
2012-09-25 18:38:13 +00:00
hallgren
31ac2add1f GF.Command.Commands: allCommands is now a constant
The dependency on PGFEnv has been moved from the list to the exec function of
the commands in the list. This means that the help command no longer needs
to generate a new list of commands and that the state of the shell
(type GF.Command.Interpreter.CommandEnv) no longer needs to contain the list
of commands.
2012-09-25 11:42:32 +00:00
kr.angelov
18fe8af964 now the meta probability for a category is explicitly specified in the statistical model instead of computed internally. this avoids rounding errors while computing the sum of a large number of small values. 2012-09-24 09:37:21 +00:00
kr.angelov
bb15542a85 in the robust parser we don't have to care about trees which yeld empty strings. this makes the parser a lot faster 2012-09-24 09:30:20 +00:00
aarne
c8ac4a9551 refactoring German VP 2012-09-23 07:46:43 +00:00
hallgren
539856de26 GFServer.hs: code improvements
Use a monad in the request handler to make the code a bit more modular and
readable.
2012-09-22 22:10:10 +00:00
hallgren
f79838c299 gf -server: also restrict the paths of uploaded files 2012-09-21 14:53:11 +00:00
hallgren
620207802f gfse: added a new "matrix view" of grammars 2012-09-21 10:45:10 +00:00
hallgren
29e2e8c9a4 simple translator: make it possible to delete documents 2012-09-21 09:07:31 +00:00
hallgren
3d3ee05704 gf -server: improved security checks
+ More restrictive limits on which file paths can be downloaded and removed.
+ Add more extensions to the list of file types that may be removed. In
  particular, allow documents created by simple translation tool to be removed.
2012-09-21 09:00:48 +00:00
hallgren
efedb1f7ba simple translator: bug fix
A bug in the line break change prevented text import from working.
2012-09-20 07:49:13 +00:00
kr.angelov
f75d1374ff the Haskell runtime now exports 'functionsByCat' which returns the list of all functions for a given category 2012-09-18 09:48:21 +00:00
kr.angelov
44df7a33cf the C runtime now has a type prob_t which is used only for probability values 2012-09-18 09:18:48 +00:00