From 10e10298d9716c35080c16887a3d50ac4668916a Mon Sep 17 00:00:00 2001 From: Krasimir Angelov Date: Wed, 30 May 2018 23:04:40 +0200 Subject: [PATCH 01/19] implemented compound nounds which work like adverbs --- examples/phrasebook/SentencesBul.gf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/phrasebook/SentencesBul.gf b/examples/phrasebook/SentencesBul.gf index cf886f27d..12638fba5 100644 --- a/examples/phrasebook/SentencesBul.gf +++ b/examples/phrasebook/SentencesBul.gf @@ -30,11 +30,11 @@ lin ACitizen p cit = let noun : N = case p.name.a.gn of { R.GSg g => lin N {s = \\nf => cit.s1 ! g ! nf; - rel = cit.s2.s; + rel = cit.s2.s; relPost = False; g = case g of {R.Masc=>R.AMasc R.Human; R.Fem=>R.AFem; R.Neut=>R.ANeut} } ; R.GPl => lin N {s = \\nf => cit.s1 ! R.Masc ! nf; - rel = cit.s2.s; + rel = cit.s2.s; relPost = False; g = R.AMasc R.Human } } ; From e969948a47466edd2cfbeaf234f9987f08e1ca64 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Mon, 11 Jun 2018 22:10:32 +0200 Subject: [PATCH 02/19] Remove .authorspellings (it was a darcs relic and now useless) --- .authorspellings | 23 ----------------------- 1 file changed, 23 deletions(-) delete mode 100644 .authorspellings diff --git a/.authorspellings b/.authorspellings deleted file mode 100644 index e289b9482..000000000 --- a/.authorspellings +++ /dev/null @@ -1,23 +0,0 @@ --- Use darcs show authors to see the number of patches per person - -Aarne Ranta , aarne@cs.chalmers.se, aarne -Björn Bringert , bringert@cs.chalmers.se, bringert -Krasimir Angelov , kr.angelov@chalmers.se,kr.angelov@gmail.com,kr_angelov@gmail.com -Peter Ljunglöf , peb,peb@cs.chalmers.se -Thomas Hallgren , hallgren@altocumulus.org -Janna Khegai , janna,janna@cs.chalmers.se -Jordi Saludes -Ramona Enache , ra.monique@gmail.com -Hans-Joachim Daniels -Jean-Philippe Bernardy -Kevin Kofler -Harald Hammarström -Olga Caprotti , olga.caprotti@gmail.com -Adam Slaski , Adam Slaski -Moisés Salvador Meza Moreno, 'Moises Meza ' -Ali El Dada , 'ali.eldada@gmail.com' -Markus Forsberg -Server Cimen -Grégoire Détrez -Ketil Malde -John J. Camilleri , john@johnjcamilleri.com, john From df6c9e047e472e978c2cb36159476b0f06592754 Mon Sep 17 00:00:00 2001 From: Inari Listenmaa Date: Tue, 12 Jun 2018 14:35:03 +0200 Subject: [PATCH 03/19] (gftest) Compare also functions of arity 0 + custom startcat for comparison --- src/tools/gftest/Grammar.hs | 18 ++++++++++-------- src/tools/gftest/Main.hs | 35 ++++++++++++++++------------------- 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/src/tools/gftest/Grammar.hs b/src/tools/gftest/Grammar.hs index 0724987b2..a72bc1686 100644 --- a/src/tools/gftest/Grammar.hs +++ b/src/tools/gftest/Grammar.hs @@ -935,6 +935,7 @@ hasConcrString gr str = type Context = String type LinTree = ((Lang,Context),(Lang,String),(Lang,String),(Lang,String)) data Comparison = Comparison { funTree :: String, linTree :: [LinTree] } + instance Show Comparison where show c = unlines $ funTree c : map showLinTree (linTree c) @@ -945,27 +946,28 @@ showLinTree :: LinTree -> String showLinTree ((an,hl),(l1,t1),(l2,t2),(_l,[])) = unlines ["", an++hl, l1++t1, l2++t2] showLinTree ((an,hl),(l1,t1),(l2,t2),(l3,t3)) = unlines ["", an++hl, l1++t1, l2++t2, l3++t3] -compareTree :: Grammar -> Grammar -> [Grammar] -> Tree -> Comparison -compareTree gr oldgr transgr t = Comparison { +compareTree :: Grammar -> Grammar -> [Grammar] -> Cat -> Tree -> Comparison +compareTree gr oldgr transgr startcat t = Comparison { funTree = "* " ++ show t , linTree = [ ( ("** ",hl), (langName gr,newLin), (langName oldgr, oldLin), transLin ) | ctx <- ctxs , let hl = show (ctx dummyHole) + , let newLin = linearize gr (ctx t) + , let oldLin = linearize oldgr (ctx t) , let transLin = case transgr of [] -> ("","") g:_ -> (langName g, linearize g (ctx t)) - , let newLin = linearize gr (ctx t) - , let oldLin = linearize oldgr (ctx t) - , newLin /= oldLin ] } + , newLin /= oldLin + ] } where w = top t c = snd (ctyp w) - cs = [ coe + cs = c:[ coe | (cat,coe) <- coercions gr , c == cat ] ctxs = concat [ contextsFor gr sc cat - | sc <- ccats gr (startCat gr) + | sc <- ccats gr startcat , cat <- cs ] langName gr = concrLang gr ++ "> " @@ -1081,7 +1083,7 @@ bestTrees fun gr cats = bestExamples fun gr $ take 200 -- change this to something else if too slow [ featIthVec gr cats size i | all (`S.member` nonEmptyCats gr) cats - , size <- [0..10] + , size <- [0..20] , let card = featCardVec gr cats size , i <- [0..card-1] ] diff --git a/src/tools/gftest/Main.hs b/src/tools/gftest/Main.hs index d68d78457..f8e122318 100644 --- a/src/tools/gftest/Main.hs +++ b/src/tools/gftest/Main.hs @@ -114,8 +114,12 @@ main = do where s = top t c = snd (ctyp s) - ctxs = concat [ contextsFor gr sc c - | sc <- ccats gr startcat ] + cs = c:[ coe + | (cat,coe) <- coercions gr + , c == cat ] + ctxs = concat [ contextsFor gr sc cat + | sc <- ccats gr startcat + , cat <- cs ] output = -- Print to stdout or write to a file if write_to_file args @@ -149,9 +153,9 @@ main = do -- Test a tree let trees = case tree args of [] -> [] - ts -> lines ts + ts -> [ readTree gr t | t <- lines ts ] output $ - unlines [ testTree' (readTree gr tree) 1 | tree <- trees ] + unlines [ testTree' tree 1 | tree <- trees ] -- Test a function let substrs xs = filter (/="*") $ groupBy (\a b -> a/='*' && b/='*') xs @@ -368,7 +372,7 @@ main = do | funName <- funs -- comes from command line arg -f , let fs@(s:_) = lookupSymbol gr funName , let cat = snd $ Grammar.typ s ] - fromTb = [ (cat,[tree]) | tree <- treebank' + fromTb = [ (cat,[tree]) | tree <- treebank'++trees , let (CC (Just cat) _) = ccatOf tree ] treesToTest = @@ -381,25 +385,18 @@ main = do writeFile file "" putStrLn "Testing functions in… " diff <- concat `fmap` - sequence [ do let cs = [ compareTree grammar otherGrammar grTrans t - | t <- trees ] + sequence [ do let cs = [ compareTree grammar otherGrammar grTrans startcat t + | t <- ttrees ] putStr $ cat ++ " \r" -- prevent lazy evaluation; make printout accurate appendFile ("/tmp/"++file) (unwords $ map show cs) - return cs - | (cat,trees) <- treesToTest ] - let relevantDiff = go [] [] diff where - go res seen [] = res - go res seen (Comparison f ls:cs) = - if null uniqLs then go res seen cs - else go (Comparison f uniqLs:res) (uniqLs++seen) cs - where uniqLs = deleteFirstsBy ctxEq ls seen - ctxEq (a,_,_,_) (b,_,_,_) = a==b - shorterTree c1 c2 = length (funTree c1) `compare` length (funTree c2) + return [ c | c@(Comparison f (x:xs)) <- cs ] + | (cat,ttrees) <- treesToTest ] + + let shorterTree c1 c2 = length (funTree c1) `compare` length (funTree c2) writeFile file $ unlines [ show comp - | comp <- sortBy shorterTree relevantDiff ] - + | comp <- sortBy shorterTree diff ] writeLinFile (langName ++ "-lin-diff.org") gr ogr putStrLn $ "Created file " ++ (langName ++ "-lin-diff.org") From d0ce46722b151f67a09e414429568afc304bfdf7 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 12 Jun 2018 15:41:05 +0200 Subject: [PATCH 04/19] Minor cleanup in webpages --- doc/gf-editor-modes.t2t | 2 +- eclipse/images/.htaccess | 5 - eclipse/index.html | 446 --------------------------------------- index.html | 5 - oldindex.html | 359 ------------------------------- 5 files changed, 1 insertion(+), 816 deletions(-) delete mode 100644 eclipse/images/.htaccess delete mode 100644 eclipse/index.html delete mode 100644 oldindex.html diff --git a/doc/gf-editor-modes.t2t b/doc/gf-editor-modes.t2t index 13b8f718c..603025834 100644 --- a/doc/gf-editor-modes.t2t +++ b/doc/gf-editor-modes.t2t @@ -23,7 +23,7 @@ instructions inside. ==Eclipse== -[GF Eclipse Plugin http://www.grammaticalframework.org/eclipse/index.html], by John J. Camilleri +[GF Eclipse Plugin https://github.com/GrammaticalFramework/gf-eclipse-plugin/], by John J. Camilleri ==Gedit== diff --git a/eclipse/images/.htaccess b/eclipse/images/.htaccess deleted file mode 100644 index 4635130a3..000000000 --- a/eclipse/images/.htaccess +++ /dev/null @@ -1,5 +0,0 @@ -# Images in this folder have moved, now hosted at GitHub -# John 2013-01-10 - -RewriteEngine On -RewriteRule ^(.*)$ https://raw.github.com/GrammaticalFramework/gf-eclipse-plugin/master/doc/images/$1 [L,R=301] \ No newline at end of file diff --git a/eclipse/index.html b/eclipse/index.html deleted file mode 100644 index 5d7405a68..000000000 --- a/eclipse/index.html +++ /dev/null @@ -1,446 +0,0 @@ - - - -GF Eclipse Plugin - - - - - - -

The GF Eclipse Plugin

-

John J. Camilleri
Updated: 22 February 2013

-

The research leading to these results has received funding from the European Union's Seventh Framework Programme (FP7/2007-2013) under grant agreement no. FP7-ICT-247914 (the MOLTO Project).

-

Introduction

-

The aim behind developing a desktop IDE for GF is to provide more powerful tools than may be possible and/or practical in a web-based environment (the GF Web IDE). In particular, the ability to resolve identifier cross-references and browse external libraries quickly during development time is one of the primary motivations for the project.

-

The choice was made to develop this desktop IDE as a plugin for the Eclipse Platform as it emerged as the most popular choice among the GF developer community. Support for the platform is vast and many tools for adapting Eclipse to domain-specific languages already exist. Unlike the zero-click Web IDE approach, using the GF Eclipse plugin requires some manual installation and configuration on the development machine.

-

License

-

The GF Eclipse Plugin is open-source under the GNU General Public License (GPL).
The licenses that cover the rest of GF are listed here. Xtext and Eclipse are released under the Eclipse Public License (EPL).

- - -

Publications

-
    -
  • Poster at EAMT 2012 in Trento, Italy
  • -
  • Paper presented at FreeRBMT 2012 in Gothenburg, Sweden.
  • -
-

Features

-
    -
  • Syntax highlighting and error detection
  • -
  • Code folding, quick block-commenting, automatic code formatting
  • -
  • Definition outlining, jump to declaration, find usage
  • -
  • Warnings for problems in module dependency hierarchy
  • -
  • Launch configurations, i.e. compilation directly from IDE
  • -
  • Use GF Shell from within Eclipse
  • -
  • Auto-completion for declared identifiers
  • -
  • Background compilation (shallow) using project builder
  • -
  • Support for Open Declaration (F3), including qualified names
  • -
  • Code generation for new languages in application grammars
  • -
  • Inline documentation for function calls, overloads
  • -
  • Proper cross-reference handling with qualified names
  • -
  • Test management and testing tool
  • -
  • External library browser
  • -
-

Release history

-

22/02/13 : (1.5.2.x) New option for specifying include/exclude build files. Progress indicators during build.

-

12/06/12 : (1.5.1.x) Support for scoping when library sources not available. Performance and implementational improvements to External Library View.

-

19/04/12 : (1.5.0.x) Removed need for .gfexternal folder. Much improved "External Libraries" view allows you to search in current scope. Memory usage improvements in scoping implementation. Validation now occurs on file open. Re-added GF Library Path field in preferences.

-

04/04/12 : (1.4.3.x) Improvements to the Test Manager. Added support for arbitrary commands in launch. Made the license information clearer.

-

22/03/12 : (1.4.2.x) Added wizard for context-free grammars (no syntax support, though). Context-menu option for toggling the GF Nature and Builder together. Test Manager now parses languages & parameters, and includes filtering and toggling options.

-

14/03/12 : (1.4.1.x) GF source files can now be anywhere in project, not necessarily at top level.

-

06/03/12 : (1.4.0.x) Test manager view. Updated launch configurations. UI improvements, new icons. Inline contextual documentation. Correct resolution of qualified identifiers. Bug fixes and some refactoring.

-

07/02/12 : (1.3.0.x) Re-written underlying GF grammar.

-

02/02/12 : (1.2.5.x) Hugely improved scoping performance. New "Clone to new language" wizard. Improved code formatting. More efficient builder. Removed library path preference. GF runtime is now automatically found.

-

23/01/12 : (1.2.4.x) Logging is now done to the Eclipse Platform Log (use "Error Log" view). Tested with Eclipse 3.6.2. Bug fixes.

-

11/01/12 : (1.2.3.x) Updated to use Xtext 2.1.0. Links to external files now moved into new "GF Library View".

-

24/11/11 : (1.2.0.x) with support for "Open Declaration" (F3) function, including for external libraries.

-

18/11/11 : Third BETA (1.1.0.x) released, overhauled to take advantage of new compiler features. Tag-based scoping with caching for better performance. Interactive console (GF Shell) for launch configs.

-

11/10/11 : Second BETA (1.0.0.x) released, with improved support for qualified names, local variable bindings, selective inheritance, module outlining, and launch configurations. Also new GF Project type.

-

01/10/11 : Initial BETA released.

- - -

Installation & updating

-

System requirements

-
    -
  1. Eclipse 3.6 or above.
  2. -
  3. GF 3.3.3 or above. The path to GF must be set within the plugin preferences (see below).
  4. -
-

Using the GF Resource Grammar Library requires that the RGL binaries are also installed on your system. If you are using the pre-compiled binaries but have separately downloaded the RGL sources to your system, you can optionally specify this path in the plugin preferences (see below).

-

Installing the plugin for the first time

-

Available Software Sites

-

In order for dependencies to be satisfied, you need to ensure that your Eclipse has the following update site URLs set:

-
    -
  • Eclipse releases (change version name to match): http://download.eclipse.org/releases/indigo
  • -
  • Xtext: http://download.eclipse.org/modeling/tmf/xtext/updates/composite/releases/
  • -
-

You can set these from Preferences → Install/Update → Available Software Sites.

-

Eclipse preferences

-

How to find the Eclipse preferences window depends on your Eclipse version and/or OS, and may be either of:

-
    -
  • Window → Preferences
  • -
  • Eclipse → Preferences
  • -
-

Installation

-
    -
  1. Inside Eclipse, go to Help → Install New Software.
  2. -
  3. Add new software site using the URL: http://www.grammaticalframework.org/eclipse/release/
  4. -
  5. Select the GF Eclipse Plugin, and make sure the Contact all update sites during install to find required software option is checked.
  6. -
  7. Click Next, accept the license agreement and install.
  8. -
  9. Accept the prompt warning that the software is unsigned.
  10. -
  11. Restart Eclipse when prompted.
  12. -
-

Settings & preferences

-
    -
  1. Add the GF perspective by clicking Window → Open Perspective → Other and choosing GF.
  2. -
  3. Open the plugin settings by going to Preferences → Grammatical Framework (image below).
  4. -
  5. The plugin will try to determine the path to your GF executable automatically, but this may need to be corrected.
    The path should include the name of the GF binary itself, e.g. /home/john/.cabal/bin/gf or C:\Users\John\GF\bin\gf.exe.
  6. -
  7. The Additional path directive setting can be used if you want to avoid writing --# -path=... directives in your source files. By default it is set to .:alltenses:prelude, but can also be left blank. This is passed to GF using the --path flag.
  8. -
  9. If you are using a pre-compiled version of the Resource Grammar Library (i.e. you didn't build it from source yourself) but you have the sources available on your system, then you can enter their path in the Library source path setting. This is optional and is only used for jumping to source definitions.
    You should enter an absolute system path, up to and including the src folder, e.g. /home/john/GF/lib/src/ or C:\Users\John\GF\lib\src\.
  10. -
  11. You can also adjust the verbosity level of the GFEP console log in the preferences window.
  12. -
-
-Plugin preferences window

Plugin preferences window

-
-

Updating the plugin

-
    -
  1. In Eclipse, go to Help → Check for updates.
  2. -
  3. Any available updates will appear in the dialog. Select them and follow the usual steps.
  4. -
-

Note: You will probably want to uncheck the Contact all update sites during install to find required software option, which is not usually needed when simply updating the plugin (it makes things go a lot slower).

-

Deprecations

-
    -
  • Any folders .gfexternal can safely deleted as of GFEP ≥ 1.5. Using Eclipse's Clean function from the Run menu will do this for you automatically.
  • -
  • If your project has a folder named (External) you can safely delete this via the Eclipse Project Explorer. It is no longer used in GFEP ≥ 1.2.3
  • -
  • If your workspace contains a log file gfep.log then you can safely delete it from your system. As of version 1.2.4, GFEP uses Eclipse's standard log file at <workspace>/.metadata/.log
  • -
-

Project settings

-

Although the plugin should take care of your project settings for you, in case anything gets messed up you can always correct them manually as follows:

-

Project nature

-

Your .project file should include the GF Project Nature as follows:

-
<natures>
-  <nature>org.grammaticalframework.eclipse.ui.natures.projectNatureID</nature>
-</natures>
-

Builder

-

Your .project file should include the GF Builder as follows:

-
<buildSpec>
-  <buildCommand>
-      <name>org.grammaticalframework.eclipse.ui.build.GFBuilderID</name>
-      <arguments>
-      </arguments>
-  </buildCommand>
-</buildSpec>
-

Specifying build files

-

As of GFEP ≥ 1.5.2, you are now able to explicitly a set of modules in your GF project which should be either included or excluded from the build process. In the inclusive case, this would normally contain your "top-level" modules. This can be done right-clicking on your project in the Project Explorer and choosing Properties → GF Build Settings. From here you simply tick which modules in your project the GF builder should compile:

-
-Project-specific build settings

Project-specific build settings

-
-

When doing this, GFEP will never attempt to compile any other files in the project. Whenever you add a new top-level module or change your module hierarchy, be sure to check these build settings again.

- - -

Getting started

-

Some steps you can follow to get a feel of of the plugin's features.

-

Video tutorial

-

A quick run through of the major features available in the GF Eclipse Plugin.

- - -

If the video doesn't appear above, you can view it at https://vimeo.com/38768382

-

The Eclipse workspace and project concepts

-

When you run Eclipse, it asks you to create or specify a workspace on your system, which is essentially the top directory that Eclipse will "see". Any code you wish to work on inside Eclipse must reside in this workspace. A workspace contains one or more projects, which may or may not be related to each other. Generally each folder under the top-level workspace directory is considered an individual project, i.e.:

-
workspace/
-    Project1/
-        file1-1.gf
-        file1-2.gf
-    Project2/
-        subdir2-1/
-            file2-1-1.gf
-            file2-1-2.gf
-        file2-1.gf
-        file2-2.gf
-

If you open an existing folder as your workspace in Eclipse, then your folders in that workspace do not automatically become Eclipse projects. To do this, you must follow the "Create new GF Project" wizard below, and give your project the exact name of the existing folder (e.g. Project1 or Project2 in the example above.)

-

GF Nature

-

The GF Nature is what makes a regular Eclipse project a GF project. If you create a new GF Project from scratch then you don't need to worry too much about them. If you already have some project set up in your Eclipse workspace, then you will need to associate the builder with your project in order for all the GF goodness to work. This will internally add the GF Builder to your project also.

-

As of 1.4.2, this can be done very easily by right-clicking on your project in the explorer and clicking Add/Remove GF Nature. If your project has the GF icon overlayed on it, then the GF nature and builder are correctly associated with it.

-

See the project settings section above if you want to mess with your .project file.

-

Metadata folders

-

GFEP will create the following metadata directories within your project:

-
    -
  • A .gfbuild directory in every folder containing GF source code, containing .gf-tags files created using the GF --tags compiler flag.
  • -
-

These can be removed manually at any time, as they will always be regenerated as necessary. You will probably want to ignore these directories in your version control system.

-

Create a new GF Project

-

If you have a folder in your workspace which you want to convert into a GF Project, then you can select it from the drop-down. This folder will then appear as an Eclipse project in your workspace.

-

New project wizard New project wizard

-

New module wizard

-

Use the GF Module wizard from File → New → Other → GF Module:

-
-New module wizard

New module wizard

-
-

You can find some small examples here. Download the files and manually add them to your Eclipse workspace to experiment with some of the plugin features.

-

Clone module wizard

-

If you want to clone an existing module into a new language, you can now do so via the Clone GF Module wizard. This is also available as a context menu option in the Project Explorer, via <Right click> → Grammatical Framework → Compile for new language:

-
-Clone GF module to new language wizard

Clone GF module to new language wizard

-
-

This will create and open a new module with the relevant replacements made. Note how in this case string constants are replaced by the empty string "". This wizard currently only works on concrete and instance modules.

-
-Newly cloned file

Newly cloned file

-
-

Workbench editor layout

-

Use Eclipse' own features to drag and drop your editor tabs to suit your needs.

-
-The editor and outline view

The editor and outline view

-
-

Outline view

-

The Outline view in the bottom-left offers a quite overview of your module structure. Clicking any of the terms will make your cursor jump to that point in the file.

-

Cross-referencing errors and warnings

-

Notice how changing a cat definition for example will produce warnings and/or errors in other the modules.

-
-Warnings and errors in the editor

Warnings and errors in the editor

-
-

Validation

-

The in-editor validation sometimes needs to be triggered/updated by a keystroke. If you can still see errors which you believe should be correct, try adding a space character to ensure the validation is re-triggered.

-

Sometimes you may get an entire file marked with errors, even though in fact there is only a single error which is causing the internal builder to fail. In such cases referring to the Problems view should help you locate the cause. This issue is particularly relevant when changes made to one module may induce errors in its descendants (e.g. renaming a parameter in a resource module). This behaviour will hopefully be improved in future versions.

-

Builder

-

For validation to work correctly, the project's Build Automatically option should be turned on. Each time you save a file (or some other change occurs in your project), the builder should get triggered which re-compiles any GF files which have changed. If the builder does not seem to get triggered, try to run a clean via Project → Clean...

-

Code formatting

-

Use the built-in code formatter to tidy your code automatically. Right-click in the editor and choose Format or use the keyboard shortcut Ctrl+Shift+F.

-

Before auto-formatting After auto-formatting

-

Syntax highlighting

-

You can change your syntax colouring styles as you wish from Preferences → Grammatical Framework → Syntax Colouring

-
-Syntax highlighting styles

Syntax highlighting styles

-
-

Launch configurations

-

Set up a launch configuration from Run → Run Configurations... → Grammatical Framework. You will see the dialog below with some fields automatically filled in for you.

-
-Launch configuration dialog

Launch configuration dialog

-
-

Run the launch config and you will see the output from the GF compiler in the console view within Eclipse.

-
-Output from the GF compiler

Output from the GF compiler

-
-

Run As... launch shortcut

-

Using the Run → Run As → Compile with GF shortcut will take the current selection or active editor and do one of two things:

-
    -
  1. If a launch configuration already exists which the current file in its Source filenames field, then that config will be launch directly.
  2. -
  3. Otherwise, a new a launch configuration window is displayed where you will need to review and confirm the default settings before continuing.
  4. -
-

Consoles

-

The plugin provides its own console view named GFEP Log, which shows log messages based on the Log Level preference (Preferences → Grammatical Framework).

-

Additionally, every time a grammar is Run a new console is opened to display the output. This console may also serve as the interactive GF Shell, depending on the Interactive Mode checkbox in your Run Configuration.

-

Eclipse does not make it obvious when multiple console windows open; click on the Display Selected Console button to switch between open consoles:

-
-Display Selected Console icon

Display Selected Console icon

-
-

If the process associated with a console window has terminated, it will be indicated in the upper-left corner as below. Such console windows can then be closed using the grey cross button:

-
-Close terminated console icon

Close terminated console icon

-
-

The Eclipse console implementation does not support command history (up arrow) or auto-completion (tab).

-

External Libraries view

-

This view is automatically populated with a list of all the external modules referenced by the current file. Double-clicking on any item provides a quick way of opening GF files which are imported into your grammar from outside your Eclipse project, for example the GF Resource Grammar Library.

-

This view also provides a text box for searching within the current module's scope, as shown in the image below. Clicking the small arrow on the right-hand side of the view provides options for case sensitive and/or regular-expression based search.

-
-External libraries view

External libraries view

-
-

Test Manager view

-

This feature works together with the launch configurations to make the process of running regression tests on your grammars quick and easy. As described in the GF Book (Section 10.5), the general development-test cycle (independent of GFEP) is as follows:

-
    -
  1. Create a file test.trees which contains a bunch of abstract syntax trees, which you want to test
  2. -
  3. Compile your grammar and linearise the trees one by one, using some command like rf -lines -tree -file=test.trees | l -table | wf -file=test.trees.out
  4. -
  5. Manually correct the output in test.trees.out and save it as your gold standard file test.trees.gold.
  6. -
  7. Each time you update your grammar, repeat step 2, then compare your new output against the gold standard using diff or some other comparison tool.
  8. -
-

The Test Manager view follows this same pattern but provides a convenient graphical interface for running your test cases and also for looking at the output, just using a few clicks:

-
-Test Manager view

Test Manager view

-
-

Note that GFEP assumes the following convention:

- - - - - - - - - - - - - - - - - - - - - -
ExtensionDescription
*.trees or *.sentencesTest input files: trees file (for testing linearisation) and sentences file (for testing parsing)
*.trees.out or *.sentences.outCorresponding output files (generated each time a test is run)
*.trees.gold or *.sentences.goldCorresponding gold standard files (manually corrected from an output file)
-

Logs

-

The GFEP writes to the Eclipse platform log. This can be accessed in two ways:

-
    -
  1. By opening the Error Log view in Eclipse
  2. -
  3. Accessing the file directly at <workspace>/.metadata/.log
  4. -
-

You can set the log verbosity from Preferences → Grammatical Framework.

- - -

Common issues and fixes

-

No identifiers are resolved and my log contains messages saying "File Syntax.gf does not exist."

-

In general, this means that something is wrong with your library path setting.

-

GFEP attempts to compile all of your files individually with GF, which is not the usual way in which you would compile your grammar. As a result, when looking for the RGL files, GF needs a little help via the path argument.

-

The normal way to do this is to specify the Library path setting from Preferences → Grammatical Framework, setting it to something like .:alltenses:prelude (this is the default setting). Note that these paths are relative to the true RGL directory, which GF should already be aware of. The value of this setting is passed to GF from GFEP using the --path flag.

-

The Library path setting is the same for all your GF projects. If you want finer-grain control over the path compiler option then you should use compiler pragmas in your source files, e.g.:

-
--# -path=.:alltenses:prelude
-

The advantage of this method is that the information is bound to the file, so you can freely compile your modules outside of GFEP without having to specify the path as a command line option to GF. The disadvantage is that you need to specify such a pragma in every single file (at least if you want to continue to use the GFEP).

-

Other strange behaviour

-

When things seem strange, the very first step is always to clean the project via Project → Clean.... I only support the latest version of the plugin, so make sure you are up to date too.

-

If problems persist, please contact me or better yet file an issue on the GitHub issue tracker (see below).

- - -

Ontology Grammar plugin

-

For information about the Ontology Grammar plugin developed by Ontotext AD, please refer here.

- - -

For developers

-

Project setup

-

In order to build/run the GFEP from source, you need to have the Xtext libraries available in your Eclipse workspace. You have two choices:

-
    -
  1. Download the Xtext libraries from http://www.eclipse.org/Xtext/download/ and add them to your existing Eclipse instance
  2. -
  3. Download a release of Eclipse packaged together with Xtext from http://xtext.itemis.com/xtext/language=en/36553/downloads
  4. -
-

In both cases make sure you get the correct version of Xtext (see below). Once you have Xtext set up, you can clone the repository locally with the following command:

-
git clone git://github.com/GrammaticalFramework/gf-eclipse-plugin.git
-

You can then add the projects under the workspace directory to your Eclipse workspace, by using the File → Import... wizard. The individual projects are:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NamespaceDescription
org.grammaticalframework.eclipse.uiCovers all UI aspects of the plugin. Depends on org.grammaticalframework.eclipse (but the opposite is not true).
org.grammaticalframework.eclipse.testsContains unit tests for the plugin. Not required for running the plugin.
org.grammaticalframework.eclipse.ontology-grammarGF Ontology Grammar Plugin for Eclipse, developed separately by Ontotext AD.
org.grammaticalframework.featureFeature project for the GF Eclipse Plugin. Exports org.grammaticalframework.eclipse and org.grammaticalframework.eclipse.ui.
org.grammaticalframework.feature.ontology-grammarFeature project for the GF Ontology Grammar Plugin. Exports org.grammaticalframework.eclipse.ontology-grammar.
org.grammaticalframework.updatesiteUpdate site project which exports both feature projects under the same category.
-

Extra dependencies for unit testing project

-

The unit testing project (org.grammaticalframework.eclipse.tests) has an extra requirement for the library org.eclipselabs.xtext.utils.unittesting, which you will probably get complaints about when importing your projects into Eclipse. You only need to worry about this if you want to run the unit tests; otherwise you can ignore these errors. You can get more information about this library here, or just install it in Eclipse directly using the following update site URL: http://xtext-utils.eclipselabs.org.codespot.com/git.distribution/releases/unittesting-0.9.x/

-

Xtext version

-

GFEP currently uses Xtext 2.1.0.

-

Running from source

-

Once you have set up your projects (see above), you can run/debug the GFEP by following the steps here. Note that this means you will be running two instances of Eclipse simultaneously; the first debugging the second.

-

Building plugin package

-

To package the GFEP sources as .jar files and install/update the GFEP in a separate Eclipse installation, do the following:

-
    -
  1. Open site.xml in the org.grammaticalframework.updatesite project with Eclipse's Site Manifest Editor (default).
  2. -
  3. Synchronize the feature versions with the update site project.
  4. -
  5. Click Build All and the necessary .jar files should be created/updated in the project's folder. These can then be copied, along with site.xml to any local or web directory, which becomes the "update site".
  6. -
-

artifacts.jar and contents.jar

-

These are two meta-data files created by the update site project. However there are known issues with categories sporadically not working in update sites, and it seems that if you delete these 2 files then the problems are solved. More about this can be found here.

-

Other notes

-

Some have mentioned than when opening the GFEP sources, under Linux, they needed to install the following:

-
sudo apt-get install appmenu-gtk
-sudo apt-get install gtk2-engines-pixbuf
- - -

Evaluation & feedback

-

Please try to use the plugin for developing your own GF projects and report any issues you come up against. Feedback (both negative and positive) on the following would be appreciated:

-
    -
  1. Issues encountered with installation
  2. -
  3. Incorrect support of GF syntactic constructs, module hierarchy system
  4. -
  5. Performance issues (speed, resources footprint)
  6. -
  7. General intuitiveness of the UI
  8. -
  9. Feature wish-list
  10. -
  11. Compatibilities / conflicts with other Eclipse plugins
  12. -
-

For all bug reports and feature requests, please use the GitHub Issue Tracker.

- - -

Appendix

-

Module types

-

Description of the GF module types and their icons within the GF Eclipse Plugin.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IconDescriptionNotes
Abstract moduleabstract Foods = {...}
Concrete moduleconcrete FoodsEng of Foods = {...}
Resource moduleresource ResFoods = {...}
Interfaceinterface LexFoods = {...}
Instanceinstance LexFoodsEng of LexFoods = {...}
Functorincomplete concrete FoodsI of Foods = {...}
Functor instantiationconcrete FoodsEng of Foods = FoodsI with (...) {...}
-

Build command

-

This is the GF command run by the builder:

-
gf --v=0 --tags --output-dir=.gfbuild [--path=PATH] FILE
- - - - diff --git a/index.html b/index.html index 664aa2b63..c6d96a6bf 100644 --- a/index.html +++ b/index.html @@ -26,7 +26,6 @@ function sitesearch() {

Grammatical Framework

A programming language for multilingual grammar applications - @@ -98,7 +94,6 @@ function sitesearch() {

Related to GF

  • Publications -
  • GF Summer Schools
  • The REMU Project
  • The MOLTO Project
  • GF on Wikipedia diff --git a/oldindex.html b/oldindex.html deleted file mode 100644 index 75c5eb0b0..000000000 --- a/oldindex.html +++ /dev/null @@ -1,359 +0,0 @@ - - - -GF - Grammatical Framework - - - - - - - - - - -
    - - -

    Grammatical Framework

    -

    -Version 3.5 -
    -August 2013 - -

    -

    - -
    -

    News

    - -
    - - -
    2014-03-11: - A company for commercial applications of GF has been founded: - Digital Grammars. -
    2013-11-25: - The default character encoding in GF grammar files will be changed - from Latin-1 to UTF-8. See - GF character encoding changes - for details. -
    2013-10-18:New resource grammar language: Estonian. - See library synopsis. -
    2013-09-18:New GF contributions repository, hosted on GitHub. -
    2013-08-06:GF 3.5 released! - Release notes. -
    2013-07-26:Started a page with RGL Documentation and Publications. -
    2013-06-24:We are now running the IRC channel #gf on the Freenode network. -
    2013-06-19:New resource grammar language: Maltese. - See library synopsis. -
    2013-04-25:New resource grammar language: Greek. - See library synopsis. -
    2013-01-31:GF 3.4 released! - Release notes. -
    2012-12-10: - Resource Grammar Library - coverage map, created by Tommi Nieminen. - -
    - -
    - -

    What is GF

    -

    -GF, Grammatical Framework, is a programming language for -multilingual grammar applications. It is -

    -
      -
    • a special-purpose language for grammars, like - YACC, - Bison, - Happy, - BNFC, - but not restricted to programming languages -
    • a functional programming language, like - Haskell, - Lisp, - OCaml, - SML, - Scheme, - but specialized to grammar writing -
    • a development platform for natural language grammars, like - LKB, - XLE, - Regulus, - but based on functional programming and type theory -
    • a categorial grammar formalism, like - ACG, - CCG, - but specialized for multilingual grammars, -
    • a logical framework, like - Agda, - Coq, - Isabelle, - but equipped with concrete syntax in addition to logic -
    • a platform for machine translation, like - Moses, - Apertium, - but based on deep structural analysis (and usually applied for - limited fragments of language). -
    - -

    -Don't worry if you don't know most of the references above - but if you do know at -least one, it may help you to get a first idea of what GF is. -

    -

    Applications

    -

    -GF can be used for building -

    - - -

    Availability

    -

    -GF is open-source, licensed under GPL (the program) and -LGPL and BSD (the libraries). It -is available for -

    -
      -
    • Linux -
    • Mac OS X -
    • Windows -
    • Android mobile platform (via Java; runtime) -
    • via compilation to JavaScript, almost any platform that has a web browser (runtime) -
    - -

    Projects

    -

    -GF was first created in 1998 at -Xerox Research Centre Europe, -Grenoble, in the project -Multilingual Document Authoring. At Xerox, it was used for prototypes including -a restaurant phrase book, -a database query system, -a formalization of an alarm system instructions with translations to 5 languages, and -an authoring system for medical drug descriptions. -

    -

    -Later projects using GF and involving third parties include, in chronological order, -

    -
      -
    • GF-Alfa: - natural language interface to formal proofs -
    • Efficient: - authoring tool for business models. -
    • GF-KeY: - authoring and translation of software specifications -
    • TALK: - multilingual and multimodal spoken dialogue systems -
    • WebALT: - multilingual generation of mathematical exercises (commercial project) -
    • SALDO: - Swedish morphological dictionary based on rules developed for GF and - Functional Morphology -
    • MOLTO: - multilingual online translation -
    • REMU: - reliable multilingual digital communication. -
    -

    -Here is a talk -about GF at XRCE, -14 years later. - -

    -Academically, GF has been used in at least ten PhD theses and resulted -in more than a hundred -scientific publications (see GF publication list). -

    -

    Programming in GF

    -

    -GF is easy to learn by following the tutorial. -You can write your first translator in 15 minutes. -

    -

    -GF has an interactive command interpreter, as well as a batch compiler. -Grammars can be compiled to parser and translator code in many different -formats. These components can then be embedded in applications written -in other programming languages. The formats currently supported are: -

    -
      -
    • Haskell -
    • Java, in particular the Android platform -
    • JavaScript -
    • Speech recognition: HTK/ATK, Nuance, JSGF -
    - -

    -The GF programming language is high-level and advanced, featuring -

    -
      -
    • static type checking -
    • higher-order functions -
    • dependent types -
    • pattern matching with data constructors and regular expressions -
    • module system with multiple inheritance and parametrized modules -
    - -

    Getting help

    -

    -If you need some help with GF, the first places to start are the Tutorial and Reference pages. -The printed book contains all the material in the tutorial and some extra bits, and is the recommended reference for GF. -

    - -

    -We run the IRC channel #gf on the Freenode network, where you are welcome to look for help with small questions or just start a general discussion. -IRC logs (in raw format) are available here. -If you have a larger question which the community may benefit from, we recommend you ask it on the mailing list. -

    - -

    Libraries

    -

    -Libraries are at the heart of modern software engineering. In natural language -applications, libraries are a way to cope with thousands of details involved in -syntax, lexicon, and inflection. The -GF resource grammar library has -support for an increasing number of languages, currently including -

    -
      -
    1. Afrikaans -
    2. Amharic (partial) -
    3. Arabic (partial) -
    4. Bulgarian -
    5. Catalan -
    6. Chinese -
    7. Danish -
    8. Dutch -
    9. English -
    10. Estonian -
    11. Finnish -
    12. French -
    13. German -
    14. Greek -
    15. Hebrew (fragments) -
    16. Hindi -
    17. Interlingua -
    18. Japanese -
    19. Italian -
    20. Latin (fragments) -
    21. Latvian -
    22. Maltese -
    23. Nepali -
    24. Norwegian bokmål -
    25. Persian -
    26. Polish -
    27. Punjabi -
    28. Romanian -
    29. Russian -
    30. Sindhi -
    31. Spanish -
    32. Swahili (fragments) -
    33. Swedish -
    34. Thai -
    35. Turkish (fragments) -
    36. Urdu -
    - -

    -Adding a language to the resource library takes 3 to 9 -months - contributions -are welcome! You can start with the resource grammarian's tutorial. - - - - - - From 27b49e0a8ba100135fe61c63bafaefe927aa6759 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 12 Jun 2018 15:43:28 +0200 Subject: [PATCH 05/19] Remove /framenet redirect for the sake of cleaning things up --- framenet/index.html | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 framenet/index.html diff --git a/framenet/index.html b/framenet/index.html deleted file mode 100644 index 33c8d48aa..000000000 --- a/framenet/index.html +++ /dev/null @@ -1,5 +0,0 @@ - - - - Redirecting... - From 5aa2a212bbbf6bce696665852d7da98f91c81d54 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Tue, 12 Jun 2018 15:53:58 +0200 Subject: [PATCH 06/19] Remove HTML files from VC which should be generated from txt2tags If these pages disappear from the web via www.grammaticalframework.org then this commit may need to be reversed --- demos/index-numbers.html | 43 - doc/gf-bibliography.html | 875 ------------------ doc/gf-reference.html | 664 ------------- download/index-3.1.6.html | 93 -- download/release-3.1.6.html | 87 -- .../{release-3.1.6.txt => release-3.1.6.t2t} | 0 gf-book/index.html | 177 ---- gf-book/{index.txt => index.t2t} | 0 8 files changed, 1939 deletions(-) delete mode 100644 demos/index-numbers.html delete mode 100644 doc/gf-bibliography.html delete mode 100644 doc/gf-reference.html delete mode 100644 download/index-3.1.6.html delete mode 100644 download/release-3.1.6.html rename download/{release-3.1.6.txt => release-3.1.6.t2t} (100%) delete mode 100644 gf-book/index.html rename gf-book/{index.txt => index.t2t} (100%) diff --git a/demos/index-numbers.html b/demos/index-numbers.html deleted file mode 100644 index 930d6895b..000000000 --- a/demos/index-numbers.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - -Portable Numeral Translator - -

    Portable Numeral Translator

    - -15 August 2008
    -
    - -

    -Here is the first GF application for the iPhone. It translates -numerals from digits into number words in 15 languages. It works for -numerals in the range 1-999,999. You can use the demo online in your iPhone's -browser, or download and install it by using FileMagnet (from AppStore). -

    -

    -The demo should work in any web browser supporting JavaScript, but it has been -specially dimensioned for the iPhone screen. It is an application of a general -technology, namely the compilation of GF grammars to JavaScript. Thus you can -easily build similar applications from your own grammars. -

    -

    -The -full numeral translator, which -works in 88 language and permits arbitrary cross translations, cannot yet be ported -to the iPhone because of memory problems. -

    -

    -The current version has some encoding/font issues in Hebrew and Hindi. -

    -

    -Use the translator online -

    -

    -Download the translator. To install: unpack the file and move -the directory numbers to your FileMagnet uploader. -

    - - - - diff --git a/doc/gf-bibliography.html b/doc/gf-bibliography.html deleted file mode 100644 index 4281f9460..000000000 --- a/doc/gf-bibliography.html +++ /dev/null @@ -1,875 +0,0 @@ - - - - - - -Grammatical Framework Bibliography - -
    -

    Grammatical Framework Bibliography

    -Aarne Ranta
    -Tue Nov 27 16:47:06 2012 -
    - -

    -
    -

    - - - -

    -
    -

    - - -

    Publications on GF

    - -

    -In reverse temporal order: -

    -

    -H. Burden and R. Heldal. -Natural Language Generation from Class Diagrams. -Proceedings of the 8th International Workshop on Model-Driven Engineering, Verification and Validation (MoDeVVa 2011), -Wellington, New Zealand, -ACM, -2011. -Draft PDF -
    -Using GF to verbalize platform-independent requirement specifications as a part of a software engineering tool chain. -

    -

    -C. España-Bonet, R. Enache, A. Slaski, A. Ranta, L. Màrquez, and M. Gonzàlez. -Patent translation within the MOLTO project. -Proceedings of the 4th Workshop on Patent Translation, -MT Summit XIII, Xiamen, China, September 23, 2011. -PDF -
    -First steps to a hybrid GF-SMT system. -

    -

    -Seyed M. Montazeri, Nivir Roy, and Gerardo Schneider. -From Contracts in Structured English to CL Specifications. -5th International Workshop on Formal Languages and Analysis of Contract-Oriented Software (FLACOS'11), -volume 68 of EPTCS, pages 55-69, -Málaga, Spain, 22-23 September 2011. -PDF/DOI -
    -Formal analysis of contracts written in controlled English. -

    -

    -S. Virk, M. Humayoun, and A. Ranta. -An Open-Source Punjabi Resource Grammar. -Proceedings of RANLP-2011, Recent Advances in Natural Language Processing, -Hissar, Bulgaria, 12-14 September, 2011. -pp. 70-76. -PDF -
    -Punjabi syntax, building on Humayoun and Ranta 2010. -

    -

    -D. Dannélls, M. Damova, R.Enache, M. Chechev. -A Framework for Improved Access to Museum Databases in the Semantic Web. -Proceedings of the Workshop on Language Technologies for Digital Humanities and Cultural Heritage, -RANLP-2011, Recent Advances in Natural Language Processing, -Hissar, Bulgaria, 12-14 September, 2011, -pp 8-15 -PDF -
    -Representing and verbalizing in GF of an Cultural Heritage ontology. -

    -

    -A. Ranta. -Translating between Language and Logic: What Is Easy and What is Difficult? -In N. Bjørner and V. Sofronie-Stokkermans (eds.), -CADE-23. Automated Deduction, -LNCS/LNAI 6803, -pp. 5-25, -2011. -PDF at Springer -Draft PDF -
    -Invited talk at the CADE conference, showing how GF can help writing natural language interfaces -to proof systems, and also exploring how to make the language richer, e.g. how to get from -"for all numbers x, x is even or x is odd" to "every number is even or odd". -

    -

    -A. Ranta. -Grammatical Framework: Programming with Multilingual Grammars, - CSLI Publications, Stanford, 2011. - Book web page -
    -Meant as the standard reference and textbook on GF. -

    -

    -O. Caprotti, K. Angelov, R. Enache, T. Hallgren, A. Ranta. -The MOLTO Phrasebook. -Swedish Language Technology Conference SLTC 2010. -PDF -
    -Tourist Phrasebook grammar, available in 14 European languages. -

    -

    -G. Détrez and R. Enache. -A Framework for Multilingual Applications on the Android Platform -Swedish Language Technology Conference SLTC 2010. -PDF -
    -A description of the Java implementation of the GF runtime system, which makes it possible -to create grammar-based applications running on an Android phone.// -

    -

    -Normunds Gruzitis and Guntis Barzdins. -Towards a More Natural Multilingual Controlled Language Interface to OWL, -9th International Conference on Computational Semantics (IWCS), -pp. 335-339, -2011. -PDF -
    -Access to ontologies in English and Latvian. -

    -

    -M. Humayoun and A. Ranta. -Developing Punjabi Morphology, Corpus and Lexicon. -The 24th Pacific Asia conference on Language, Information and Computation (PACLIC24), -2010. -
    -Yet another South-East Asian language, spoken by 88 million people. -

    -

    -J. Camilleri, Gordon J. Pace, and Mike Rosner. -Playing Nomic using a Controlled Natural Language. -CNL 2010, Controlled Natural Language, -Marettimo, -2010. -
    -Using GF for defining the rules of a game. -

    -

    -R. Enache and K. Angelov -Typeful Ontologies with Direct Multilingual Verbalization. -CNL 2010, Controlled Natural Language, -Marettimo, -2010. -
    -Investigating the benefits of using GF as a language for representing ontologies. -PDF -

    -

    -S. Virk, M. Humayoun, and A. Ranta. -An Open Source Urdu Resource Grammar. -Proceedings of the 8th Workshop on Asian Language Resources (Coling 2010 workshop), -2010. -
    -The national language of Pakistan, spoken by 60 million people; almost the same as Hindi. -

    -

    -A. Ranta, K. Angelov, and T. Hallgren. -Tools for multilingual grammar-based translation on the web. -Proceedings of the ACL 2010 System Demonstrations, -ACM Digital Library, -2010. -PDF -
    -An overview of GF for developers and users of translation systems. -

    -

    -D. Dannélls and J. Camilleri. -Verb Morphology of Hebrew and Maltese - Towards an Open Source Type Theoretical Resource Grammar in GF. -Proceedings of the Language Resources (LRs) and Human Language Technologies (HLT) for Semitic Languages Status, Updates, and Prospects, LREC-2010 Workshop, -Malta, pp. 57-61. -2010. -PDF -
    -A study of Semitic non-concatenative morphology from the GF point of view. -

    -

    -M. Humayoun and C. Raffalli. -MathNat - Mathematical Text in a Controlled Natural Language. -Special issue: Natural Language Processing and its Applications. Journal on Research in Computing Science, Volume 46. -2010. -
    -Natural language interface to a proof system, implemented in GF. -

    -

    -D. Dannélls. -Discourse Generation from Formal Specifications Using the Grammatical Framework, GF. -Special issue: Natural Language Processing and its Applications. Journal on Research in Computing Science (RCS), -volume 46. pp. 167-178, -2010. -
    -Interfacing GF with ontology, with a natural language generation perspective. -

    -

    -R. Enache, A. Ranta, and K. Angelov. -An Open-Source Computational Grammar of Romanian. -A. Gelbukh (ed.), CiCLING-2010, -LNCS 6008, -2010. -
    -A Romance language different enough not to follow the Romance functor. -

    -

    -K. Angelov and A. Ranta. -Implementing Controlled Languages in GF. -N. Fuchs (ed.), CNL-2009 Controlled Natural Languages, -LNCS/LNAI 5972, -2010. -

    -

    -K. Angelov, B. Bringert and A. Ranta. -PGF: A Portable Run-time Format for Type-theoretical Grammars, -Journal of Logic, Language and Information, -19(2), -pp. 201-228, -2009. -SpringerLink -

    -

    -A. Ranta. -The GF Resource Grammar Library. -Linguistic Issues in Language Technology, -2 (2), -2009. -PDF -
    -A systematic presentation of the library from the linguistic point of view. -

    -

    -A. Ranta. -Grammatical Framework: A Multilingual Grammar Formalism, -Language and Linguistics Compass, -Vol. 3, on-line -2009. -
    -An overview of GF for readers with a general academic brackground. -

    -

    -A. Ranta and K. Angelov. -Implementing Controlled Languages in GF. -CNL-2009, -CEUR Workshop Proceedings, -vol. 448, -on-line, -2009. -
    -Makes a case for using GF in controlled language implementation, illustrated by Attempto Controlled English ported to French, German, and Swedish; longer version in 2010. -

    -

    -A. Ranta. Grammars as Software Libraries. -In Y. Bertot, G. Huet, J-J. Lévy, and G. Plotkin (eds.), -From Semantics to Computer Science, -Cambridge University Press, Cambridge, -pp. 281-308, -2009. -pdf (preliminary version) -
    -Grammar-libraries from the software engineering point of view, with an example application to mathematical language. -

    -

    -K. Angelov. -Incremental Parsing in Parallel Multiple Context-Free Grammars. -EACL 2009. -
    -Describes the algorithm used in parsing with GF. -

    -

    -A. Ranta, B. Bringert, and K. Angelov. -The GF Grammar Development Environment. -System demo. Proceedings of EACL-2009, -2009. -PDF -
    -An overview of GF from the grammarian's point of view. -

    -

    -B. Bringert, K. Angelov, and A. Ranta. -Grammatical Framework Web Service, -System demo. Proceedings of EACL-2009, -2009. -PDF -
    -An overview of how to build web services on top of PGF using the Google Web Toolkit. -

    -

    -A. Ranta and K. Angelov. -Implementing Controlled Languages in GF, -To appear in the proceedings of CNL-2009, LNCS, Springer, -2009. -
    -On the use of GF for controlled languages, exemplified by an implementation of Attempto Controlled English then ported to three other language. -

    -

    -R. Cooper and A. Ranta. -Natural Languages as Collections of Resources. -In Language in Flux: Dialogue Coordination, Language Variation, Change, -ed. by R. Cooper and R. Kempson, pp. 109-120. London: College Publications, -2008. -
    -The resource grammar idea applied to language learning and evolution. -

    -

    -Moisés Salvador Meza Moreno and B. Bringert. -Interactive Multilingual Web Applications with Grammatical Framework. -In B. Nordström and A. Ranta (eds), -Advances in Natural Language Processing (GoTAL 2008), -LNCS/LNAI 5221, Springer, -2008. -
    -Shows how GF compiled to JavaScript is used in dynamic multilingual web pages. -

    -

    -Peter Ljunglöf and Staffan Larsson. -A grammar formalism for specifying ISU-based dialogue systems. -In B. Nordström and A. Ranta (eds), -Advances in Natural Language Processing (GoTAL 2008), -LNCS/LNAI 5221, Springer, -2008. -pdf -
    -Explains how GoDiS dialogue systems are specified by GF grammars. -

    -

    -K. Angelov. -Type-Theoretical Bulgarian Grammar. -In B. Nordström and A. Ranta (eds), -Advances in Natural Language Processing (GoTAL 2008), -LNCS/LNAI 5221, Springer, -2008. -
    -Explains the implementation of a Bulgarian resource grammar in GF. -

    -

    -B. Bringert. -High-precision Domain-specific Interlingua-based Speech Translation -with Grammatical Framework. -Coling 2008 Workshop on Speech Translation for Medical and Other Safety-Critical Applications, -Manchester, UK, August 23, -2008. -
    -Shows how to build spoken language translators based on GF grammars and their compilation to Nuance. -

    -

    -A. Ranta. -How predictable is Finnish morphology? An experiment on lexicon construction. -In J. Nivre, M. Dahllöf and B. Megyesi (eds), -Resourceful Language Technology: Festschrift in Honor of Anna Sågvall Hein, -University of Uppsala, -2008. -Available from series homepage -
    -Presents an experiment on smart paradigms in Finnish. -

    -

    -A. Ranta. -Example-based grammar writing. -To appear in L. Borin and S. Larsson (eds), -Festschrift for Robin Cooper, -2007. -
    -Presents and discusses the ideas of grammar composition and example-based grammar writing. -

    -

    -B. Bringert. -Rapid Development of Dialogue Systems by Grammar Compilation. -8th SIGdial Workshop on Discourse and Dialogue, -Antwerp, Belgium, September 1-2, -2007. -pdf -
    -Shows how to build a web-based spoken dialogue system by generating VoiceXML and JavaScript. -

    -

    -A. El Dada and A. Ranta. -Implementing an Open Source Arabic Resource Grammar in GF. -In M. Mughazy (ed), -Perspectives on Arabic Linguistics XX. Papers from the Twentieth Annual Symposium on Arabic Linguistics, Kalamazoo, March 26 -John Benjamins Publishing Company. -2007. -
    -An outline of the Arabic resource grammar project, focusing on linguistic aspects. -

    -

    -A. El Dada. -Implementation of the Arabic Numerals and their Syntax in GF. -Computational Approaches to Semitic Languages: Common Issues and Resources, - ACL-2007 Workshop, -June 28, 2007, Prague. -2007. -
    -A case study with the resource grammar, focusing on the morphosyntax -and agreement of constructions with numerals. -

    -

    -A. Ranta. -Modular Grammar Engineering in GF. -Research on Language and Computation, -5:133-158, 2007. -Draft available as pdf. -
    -Adapts library-based software engineering methods to grammar writing -and introduces the module system of GF. -

    -

    -A. Ranta. -The GF Grammar Compiler. -Workshop on New Directions in Type-theoretic Grammars, -Dublin, August 2007 (ESSLLI workshop). -2007. -pdf -
    -Describes the compilation of GF source code to lower-level run-time formats. -

    -

    -M. Humayoun, H. Hammarström, and A. Ranta. -Urdu Morphology, Orthography and Lexicon Extraction. -CAASL-2: The Second Workshop on Computational Approaches to Arabic Script-based Languages, -July 21-22, 2007, LSA 2007 Linguistic Institute, Stanford University. -2007. -
    -Fairly complete open-source Urdu morphology and elemenraty syntax in GF. -

    -

    -N. Perera and A. Ranta. -Dialogue System Localization with the GF Resource Grammar Library. -SPEECHGRAM 2007: ACL Workshop on Grammar-Based Approaches to Spoken Language Processing, -June 29, 2007, Prague. -2007. -pdf -
    -An experiment in porting an in-car dialogue system from two to six languages. -

    -

    -B. Bringert. -Speech Recognition Grammar Compilation in Grammatical Framework -SPEECHGRAM 2007: ACL Workshop on Grammar-Based Approaches to Spoken Language Processing, -June 29, 2007, Prague. -2007. -
    -Generation of speech recognition language models from GF in several formats: -GSL (Nuance), SRGS, JSGF, and HTK SLF, with embedded semantic interpretation. -

    -

    -A. Ranta. -Features in Abstract and Concrete Syntax. -The 2nd International Workshop on Typed Feature Structure Grammars, -Tartu, 24 May 2007 (NODALIDA workshop). -2007. -pdf -
    -Explores the design choices of incorporating features in a GF-like grammar, -with comparisons to feature-based unification grammars. -

    -

    -O. Caprotti and M. Seppälä. -Multilingual Delivery of Online Tests in mathematics. -Proceedings of Online Educa Berlin 2006. 29 November - 1 December 2006. - Berlin, Germany. -2006. -pdf -
    -This papers shows screenshots of multilingual generation in the -WebALT project, using GF and the resource grammar library. -

    -

    -J. Khegai. -Language engineering in Grammatical Framework (GF). -Phd thesis, Computer Science, Chalmers University of Technology, -2006. -pdf -
    -Collection of articles and technical reports on multilingual authoring -and the Russian resource grammar. -

    -

    -B. Bringert and A. Ranta. -A Pattern for Almost Compositional Functions. -ICFP 2006, The 11th ACM SIGPLAN International Conference on Functional Programming, Portland, Oregon, September 18-20, 2006, -2006. -pdf. -
    -A method of generic programming useful for compiler construction -and transfer-based translation. -

    -

    -M. Forsberg, H. Hammarstrom, and A. Ranta. -Morphological Lexicon Extraction from Raw Text Data. -FinTAL 2006, -Turku, August 23-25, 2006. -Springer LNCS/LNAI 4139, -pp. 488-499, -2006. -
    -A method for automatical production of morphological lexica based -on inflection engines such as those of GF resource grammar library. -

    -

    -A. Ranta. -Type Theory and Universal Grammar. -Philosophia Scientiae, Constructivism: Mathematics, Logic, Philosophy and Linguistics, -cahier spécial 6, -pp. 115-131, -2006. -
    -A philosophical study of the medieval thesis that -grammar is the same in all languages and the difference is only in words. -

    -

    -J. Khegai. -GF parallel resource grammars and Russian. -In proceedings of ACL2006 - (The joint conference of the International Committee on Computational - Linguistics and the Association for Computational Linguistics) (pp. 475-482), - Sydney, Australia, July 2006. -
    -Gives an outline of the Russian resource grammar project. -

    -

    -J. Khegai. -Grammatical Framework (GF) for MT in sublanguage domains. -Proceedings of 11th Annual conference of the European Association for - Machine Translation, , Oslo. -pp. 95-104, -2005. -
    -Shows how GF is used in controlled language translation. -

    -

    -W. Ng'ang'a. -Multilingual content development for eLearning in Africa. -eLearning Africa: 1st Pan-African Conference on ICT for Development, - Education and Training. 24-26 May 2006, Addis Ababa, Ethiopia. -2006. -pdf -
    -Presents a programme for producing educational material in African languages -via multilingual generation in GF. -

    -

    -R. Jonson. -Generating statistical language models from interpretation grammars in dialogue system. -In Proceedings of EACL'06, Trento, Italy. -2006. -
    -Uses GF grammars to generate statistical language models for speech recognition. -

    -

    -A. El Dada and A. Ranta. -Arabic Resource Grammar. -Arabic Language Processing (JETALA), -5-6 June 2006, IERA, Rabat, Morocco, -2006. -
    -An outline of the Arabic resource grammar project, focusing on software aspects. -

    -

    -D. A. Burke and K. Johannisson. -Translating Formal Software Specifications to Natural Language. A Grammar-Based Approach. -In P. Blache, E. Stabler, J. Busquets and R. Moot (eds), -Logical Aspects of Computational Linguistics (LACL 2005), -Springer LNAI 3402, -pp. 51-66, -2005. -
    -A paper explaining how a multilingual GF grammar is completed with -Natural Language Generation techniques to improve text quality. -

    -

    -B. Bringert, R. Cooper, P. Ljunglöf, A. Ranta, -Multimodal Dialogue System Grammars. -Proceedings of DIALOR'05, Ninth Workshop on the Semantics and Pragmatics of Dialogue, Nancy, France, June 9-11, 2005, -2005. -pdf. -
    -Shows how mouse clicks can be integrated in GF grammars -alongside with speech input. -

    -

    -K. Johannisson, -Formal and Informal Software Specifications. -PhD thesis, -Computer Science, Göteborg University, -2005. -[http://www.cse.chalmers.se/~krijo/thesis/thesisA4.pdf] -
    -Collection of articles in the GF-KeY project, with an introduction. -

    -

    -P. Ljunglöf. -Expressivity and Complexity of the Grammatical Framework. -PhD thesis, Computer Science, -Göteborg University, -2004. -pdf -
    -Language-theoretical study of GF and its parsing problem. -

    -

    -A. Ranta. -Grammatical Framework: A Type-Theoretical Grammar Formalism. -Journal of Functional Programming, 14(2), -pp. 145-189, -2004. -Draft available as ps.gz. -
    -Theoretical paper explaining the GF formalism and its implementation. -The standard reference on GF, but doesn't cover the module system. -

    -

    -A. Ranta. -Computational semantics in type theory. -Mathematics and Social Sciences, 165, -pp. 31-57, -2004. -Draft available as pdf. -
    -// Shows how Montague-style grammars are implemented in GF and extends// -this to type-theoretical grammars for anaphoric expressions. -

    -

    -H. Hammarström and A. Ranta. -Cardinal Numerals Revisited in GF. -Workshop on Numerals in the World's Languages. -Dept. of Linguistics Max Planck Institute for Evolutionary Anthropology, Leipzig, -2004. -
    -An overview of the numeral grammar project, covering 88 languages. -

    -

    -A. Ranta. -Grammatical Framework Tutorial. -In A. Beckmann and N. Preining, editors, -ESSLLI 2003 Course Material I, -Collegium Logicum, -volume V, -pp. 1-86. -Kurt Gödel Society, -Vienna, -2004. -
    -A revised version of the on-line GF tutorial, v1.0. -

    -

    -J. Khegai and A. Ranta. -Building and Using a Russian Resource Grammar in GF. -In A. Gelbukh (ed), -Intelligent Text Processing and Computational Linguistics (CICLing-2004), -Seoul, Korea, February 2003, -Springer LNCS 945, -pp. 38-41, -2004. -ps.gz. -
    -An introduction to the GF resource grammar project, with Russian as prime example. -

    -

    -A. Ranta and R. Cooper. -Dialogue Systems as Proof Editors. - Journal of Logic, Language and Information, 13, -pp. 225-240, -2004. -Conference version (IJCAR/ICoS-3, Siena, June 2001) available as - ps.gz. -Shows a close analogy between task-oriented dialogue systems -and metavariable-based proof editors. -

    -

    -J. Khegai and A. Ranta. -Building and Using a Russian Resource Grammar in GF. -In A. Gelbukh (ed), -Intelligent Text Processing and Computational Linguistics (CICLing-2004), -Seoul, Korea, February 2003, -Springer LNCS 945, -pp. 38-41, -2004. -ps.gz. -
    -Explains how the GF GUI is used in syntax editing and discusses -how new grammars are created. -

    -

    -R. Hähnle, K. Johannisson, and A. Ranta. -An Authoring Tool for Informal and Formal Requirements Specifications. -In R. D. Kutsche and H. Weber (eds), -ETAPS/FASE-2002: Fundamental Approaches to Software Engineering, -Springer LNCS, -vol. 2306, -pp. 233--248, -2002. -pdf -
    -Describes a GF-based authoring tool for object-oriented -specifications in OCL and English. Carries out in full -the work proposed in the position paper (Hähnle & Ranta 2001). -

    -

    -K. Johannisson and A.Ranta, -Formal Verification of Multilingual Instructions. -Proceedings of the Joint Winter Meeting 2001. -Departments of Computer Science and Computer Engineering, -Chalmers University of Technology and Göteborg University. -2001. -ps.gz. -
    -Instructions for an alarm system in four languages, verified in the proof editor Alfa. -

    -

    -R. Hähnle and A. Ranta, -Connecting OCL with the Rest of the World. -ETAPS 2001 Workshop on Transformations in UML (WTUML), -Genova, -2001. -ps.gz. -
    -A position paper explaining how GF can be used to help in object-oriented -modelling, with some examples on natural-language interaction with -OCL (Object Constraint Language). -

    -

    -T. Hallgren, "The Correctness of Insertion Sort", -Manuscript, Chalmers University, Göteborg, 2001. -Available in -ps -
    -A seven-page text generated by GF-Alfa. -

    -

    -A. Ranta. "Bescherelle bricolé", -ps.gz, -2001. -
    -A machine-generated book on French conjugation implemented in GF. -

    -

    -T. Hallgren and A. Ranta, -An Extensible Proof Text Editor. -In M. Parigot and A. Voronkov (eds), -Logic for Programming and Automated Reasoning (LPAR'2000), -LNCS/LNAI 1955, -pp. 70-84, -Springer Verlag, Heidelberg, -2000. -ps.gz. -
    -Describes an interface to the proof editor Alfa written in GF. -

    -

    -M. Dymetman, V. Lux, and A. Ranta, -XML and multilingual document authoring: converging trends. -Proceedings of the The 18th International Conference on Computational Linguistics (COLING 2000), -pp. 243-249, -Saarbruecken, -2000. -ps.gz. -
    -Relates GF not only with XML but also with definite clause grammars. -

    -

    -P. Mäenpää and A. Ranta. -The type theory and type checker of GF. -Colloquium on Principles, Logics, and Implementations of High-Level Programming Languages, Workshop on Logical Frameworks and Meta-languages, Paris, 28 September 1999. -1999. -ps.gz. -
    -Concise theoretical presentation of GF, using the old notation prior to v0.9. -

    - - -

    Background for GF

    - -

    -In alphabetical order: -

    -

    -L. Magnusson. -The Implementation of ALF - a Proof Editor based on Martin-Löf's -Monomorphic Type Theory with Explicit Substitutions. -PhD Thesis, Department of Computing Science, -Chalmers University of Technology and Göteborg University, -1994. -
    -Back in 1992 the most wonderful program in the world, ALF is -a model that GF directly follows: GF is Yet ALF. -

    -

    -P. Martin-Löf. -Intuitionistic Type Theory. -Bibliopolis, Naples, 1984. -
    -A very accessible book (if you have access to it!) on type theory directly from the source. -

    -

    -B. Nordström, K. Petersson, and J. Smith. -Programming in Martin-Löf's Type Theory: an Introduction. -Oxford University Press, 1990. - The book is out of print, but a free version can be picked up from -www.cse.chalmers.se/Cs/Research/Logic/book/ -
    -Standard reference on the subject. -

    -

    -A. Ranta. -Type Theoretical Grammar. -Oxford University Press, Oxford, -1994. -
    -Monograph on type theory in linguistics. Includes an introduction -to type theory. Focused on semantics, in particular anaphora. A first, -very rudimentary implementation of linearization in the proof system ALF. -

    -

    -A. Ranta. -Syntactic categories in the language of mathematics. -In P. Dybjer, B. Nordström, and J. Smith, eds., -Types for Proofs and Programs, -pp. 162-182, -Lecture Notes in Computer Science -996, -Springer-Verlag, -Heidelberg, -1995. -ps.gz -
    -Predecessor of GF: grammar defined in type theory and implemented in ALF. -

    -

    -A. Ranta. -Context-relative syntactic categories and the formalization of mathematical text. -In S. Berardi and M. Coppo, eds., -Types for Proofs and Programs, -pp. 231-248, -Lecture Notes in Computer Science -1158, -Springer-Verlag, -Heidelberg, -1996. -ps.gz. -
    -Extending the theory of the previous paper. The implementation in ALF -eventually became so heavy that the need arose for GF. -

    -

    -A. Ranta. -Structures grammaticales dans le français mathématique. -Mathématiques, informatique et Sciences Humaines., -vol. 138 pp. 5-56 and 139 pp. 5-36, -1997. -
    -A rather comprehensive French grammar presented in a type-theoretical style. -

    -

    -A. Ranta. - Syntactic calculus with dependent types. - Journal of Logic, Language and Information, vol. 4, - pp. 413-431, 1998. -
    -Interprets Lambek Calculus in type theory and defines some extensions. -

    - - - - diff --git a/doc/gf-reference.html b/doc/gf-reference.html deleted file mode 100644 index 330e30c7f..000000000 --- a/doc/gf-reference.html +++ /dev/null @@ -1,664 +0,0 @@ - - - - - -GF Quick Reference - -
    -

    GF Quick Reference

    -Aarne Ranta
    -April 4, 2006 -
    - -

    -
    -

    - - - -

    -
    -

    -

    -This is a quick reference on GF grammars. It aims to -cover all forms of expression available when writing -grammars. It assumes basic knowledge of GF, which -can be acquired from the -GF Tutorial. -Help on GF commands is obtained on line by the -help command (help), and help on invoking -GF with (gf -help). -

    - - -

    A complete example

    - -

    -This is a complete example of a GF grammar divided -into three modules in files. The grammar recognizes the -phrases one pizza and two pizzas. -

    -

    -File Order.gf: -

    - -
    -  abstract Order = {
    -  cat 
    -    Order ; 
    -    Item ;
    -  fun 
    -    One, Two : Item -> Order ;
    -    Pizza : Item ;
    -  }
    -
    - -

    -File OrderEng.gf (the top file): -

    - -
    -  --# -path=.:prelude
    -  concrete OrderEng of Order = 
    -   open Res, Prelude in {
    -  flags startcat=Order ;
    -  lincat 
    -    Order = SS ; 
    -    Item  = {s : Num => Str} ;
    -  lin 
    -    One it = ss ("one" ++ it.s ! Sg) ;
    -    Two it = ss ("two" ++ it.s ! Pl) ;
    -    Pizza  = regNoun "pizza" ;
    -  }
    -
    - -

    -File Res.gf: -

    - -
    -  resource Res = open Prelude in {
    -  param Num = Sg | Pl ;
    -  oper regNoun : Str -> {s : Num => Str} =
    -    \dog -> {s = table {
    -      Sg => dog ;
    -      _  => dog + "s"
    -      }
    -    } ;
    -  }
    -
    - -

    -To use this example, do -

    - -
    -    % gf             -- in shell: start GF
    -    > i OrderEng.gf  -- in GF: import grammar
    -    > p "one pizza"  --        parse string
    -    > l Two Pizza    --        linearize tree
    -
    - - -

    Modules and files

    - -

    -One module per file. -File named Foo.gf contains module named -Foo. -

    -

    -Each module has the structure -

    - -
    -  moduletypename =   
    -    Inherits **        -- optional
    -    open Opens in      -- optional
    -    { Judgements }   
    -
    - -

    -Inherits are names of modules of the same type. -Inheritance can be restricted: -

    - -
    -    Mo[f,g],  -- inherit only f,g from Mo
    -    Lo-[f,g]  -- inheris all but f,g from Lo
    -
    - -

    -Opens are possible in concrete and resource. -They are names of modules of these two types, possibly -qualified: -

    - -
    -    (M = Mo), -- refer to f as M.f or Mo.f
    -    (Lo = Lo) -- refer to f as Lo.f
    -
    - -

    -Module types and judgements in them: -

    - -
    -  abstract A          -- cat, fun, def, data
    -  concrete C of A     -- lincat, lin, lindef, printname
    -  resource R          -- param, oper
    -  
    -  interface I         -- like resource, but can have
    -                         oper f : T without definition
    -  instance J of I     -- like resource, defines opers
    -                         that I leaves undefined
    -  incomplete          -- functor: concrete that opens 
    -   concrete CI of A =    one or more interfaces
    -    open I in ...
    -  concrete CJ of A =  -- completion: concrete that
    -    CI with              instantiates a functor by
    -      (I = J)            instances of open interfaces
    -
    - -

    -The forms -param, oper -may appear in concrete as well, but are then -not inherited to extensions. -

    -

    -All modules can moreover have flags and comments. -Comments have the forms -

    - -
    -  -- till the end of line
    -  {- any number of lines between -}
    -  --# used for compiler pragmas
    -
    - -

    -A concrete can be opened like a resource. -It is translated as follows: -

    - -
    -  cat C          --->  oper C : Type = 
    -  lincat C = T           T ** {lock_C : {}}
    -  
    -  fun f : G -> C --->  oper f : A* -> C* = \g -> 
    -  lin f = t              t g ** {lock_C = <>}          
    -
    - -

    -An abstract can be opened like an interface. -Any concrete of it then works as an instance. -

    - - -

    Judgements

    - -
    -  cat C               -- declare category C
    -  cat C (x:A)(y:B x)  -- dependent category C
    -  cat C A B           -- same as C (x : A)(y : B)
    -  fun f : T           -- declare function f of type T
    -  def f = t           -- define f as t
    -  def f p q = t       -- define f by pattern matching
    -  data C = f | g      -- set f,g as constructors of C
    -  data f : A -> C     -- same as 
    -                         fun f : A -> C; data C=f
    -  
    -  lincat C = T        -- define lin.type of cat C
    -  lin f = t           -- define lin. of fun f
    -  lin f x y = t       -- same as lin f = \x y -> t
    -  lindef C = \s -> t  -- default lin. of cat C
    -  printname fun f = s -- printname shown in menus
    -  printname cat C = s -- printname shown in menus
    -  printname f = s     -- same as printname fun f = s
    -  
    -  param P = C | D Q R -- define parameter type P 
    -                         with constructors
    -                         C : P, D : Q -> R -> P
    -  oper h : T = t      -- define oper h of type T
    -  oper h = t          -- omit type, if inferrable
    -  
    -  flags p=v           -- set value of flag p
    -
    - -

    -Judgements are terminated by semicolons (;). -Subsequent judgments of the same form may share the -keyword: -

    - -
    -  cat C ; D ;         -- same as cat C ; cat D ;
    -
    - -

    -Judgements can also share RHS: -

    - -
    -  fun f,g : A         -- same as fun f : A ; g : A
    -
    - - -

    Types

    - -

    -Abstract syntax (in fun): -

    - -
    -  C                -- basic type, if cat C
    -  C a b            -- basic type for dep. category
    -  (x : A) -> B     -- dep. functions from A to B
    -  (_ : A) -> B     -- nondep. functions from A to B
    -  (p,q : A) -> B   -- same as (p : A)-> (q : A) -> B
    -  A -> B           -- same as (_ : A) -> B
    -  Int              -- predefined integer type
    -  Float            -- predefined float type
    -  String           -- predefined string type
    -
    - -

    -Concrete syntax (in lincat): -

    - -
    -  Str              -- token lists
    -  P                -- parameter type, if param P
    -  P => B           -- table type, if P param. type
    -  {s : Str ; p : P}-- record type
    -  {s,t : Str}      -- same as {s : Str ; t : Str}
    -  {a : A} **{b : B}-- record type extension, same as  
    -                      {a : A ; b : B}
    -  A * B * C        -- tuple type, same as
    -                      {p1 : A ; p2 : B ; p3 : C}
    -  Ints n           -- type of n first integers
    -
    - -

    -Resource (in oper): all those of concrete, plus -

    - -
    -  Tok              -- tokens (subtype of Str)
    -  A -> B           -- functions from A to B
    -  Int              -- integers
    -  Strs             -- list of prefixes (for pre)
    -  PType            -- parameter type
    -  Type             -- any type
    -
    - -

    -As parameter types, one can use any finite type: -P defined in param P, -Ints n, and record types of parameter types. -

    - - -

    Expressions

    - -

    -Syntax trees = full function applications -

    - -
    -  f a b              -- : C if fun f : A -> B -> C
    -  1977               -- : Int
    -  3.14               -- : Float
    -  "foo"              -- : String
    -
    - -

    -Higher-Order Abstract syntax (HOAS): functions as arguments: -

    - -
    -  F a (\x -> c)      -- : C if a : A, c : C (x : B), 
    -                        fun F : A -> (B -> C) -> C
    -
    - -

    -Tokens and token lists -

    - -
    -  "hello"            -- : Tok, singleton Str
    -  "hello" ++ "world" -- : Str
    -  ["hello world"]    -- : Str, same as "hello" ++ "world"
    -  "hello" + "world"  -- : Tok, computes to "helloworld"
    -  []                 -- : Str, empty list
    -
    - -

    -Parameters -

    - -
    -  Sg                   -- atomic constructor
    -  VPres Sg P2          -- applied constructor
    -  {n = Sg ; p = P3}    -- record of parameters
    -
    - -

    -Tables -

    - -
    -  table {              -- by full branches
    -    Sg => "mouse" ;
    -    Pl => "mice"
    -    }
    -  table {              -- by pattern matching
    -    Pl => "mice" ;
    -    _  => "mouse"      -- wildcard pattern
    -    }
    -  table {               
    -    n => regn n "cat"  -- variable pattern 
    -    }
    -  table Num {...}      -- table given with arg. type
    -  table ["ox"; "oxen"] -- table as course of values
    -  \\_ => "fish"        -- same as table {_ => "fish"} 
    -  \\p,q => t           -- same as \\p => \\q => t
    -  
    -  t ! p                -- select p from table t
    -  case e of {...}      -- same as table {...} ! e 
    -
    - -

    -Records -

    - -
    -  {s = "Liz"; g = Fem} -- record in full form
    -  {s,t = "et"}         -- same as {s = "et";t= "et"}
    -  {s = "Liz"} **       -- record extension: same as
    -    {g = Fem}             {s = "Liz" ; g = Fem}
    -  
    -  <a,b,c>        -- tuple, same as {p1=a;p2=b;p3=c}
    -
    - -

    -Functions -

    - -
    -  \x -> t            -- lambda abstract
    -  \x,y -> t          -- same as \x -> \y -> t
    -  \x,_ -> t          -- binding not in t
    -
    - -

    -Local definitions -

    - -
    -  let x : A = d in t -- let definition
    -  let x = d in t     -- let defin, type inferred
    -  let x=d ; y=e in t -- same as 
    -                        let x=d in let y=e in t
    -  let {...} in t     -- same as let ... in t
    -  
    -  t where {...}      -- same as let ... in t
    -
    - -

    -Free variation -

    - -
    -  variants {x ; y}     -- both x and y possible
    -  variants {}          -- nothing possible
    -
    - -

    -Prefix-dependent choices -

    - -
    -  pre {"a" ; "an" / v} -- "an" before v, "a" otherw.
    -  strs {"a" ; "i" ;"o"}-- list of condition prefixes
    -
    - -

    -Typed expression -

    - -
    -  <t:T>                -- same as t, to help type inference
    -
    - -

    -Accessing bound variables in lin: use fields $1, $2, $3,.... -Example: -

    - -
    -  fun F : (A : Set) -> (El A -> Prop) -> Prop ; 
    -  lin F A B = {s = ["for all"] ++ A.s ++ B.$1 ++ B.s}
    -
    - - -

    Pattern matching

    - -

    -These patterns can be used in branches of table and -case expressions. Patterns are matched in the order in -which they appear in the grammar. -

    - -
    -  C                 -- atomic param constructor
    -  C p q             -- param constr. applied to patterns
    -  x                 -- variable, matches anything
    -  _                 -- wildcard, matches anything
    -  "foo"             -- string
    -  56                -- integer
    -  {s = p ; y = q}   -- record, matches extensions too
    -  <p,q>             -- tuple, same as {p1=p ; p2=q}
    -  p | q             -- disjunction, binds to first match
    -  x@p               -- binds x to what p matches
    -  - p               -- negation
    -  p + "s"           -- sequence of two string patterns
    -  p*                -- repetition of a string pattern
    -
    - - -

    Sample library functions

    - -
    -  -- lib/prelude/Predef.gf
    -  drop   : Int -> Tok -> Tok   -- drop prefix of length
    -  take   : Int -> Tok -> Tok   -- take prefix of length
    -  tk     : Int -> Tok -> Tok   -- drop suffix of length
    -  dp     : Int -> Tok -> Tok   -- take suffix of length
    -  occur  : Tok -> Tok -> PBool -- test if substring
    -  occurs : Tok -> Tok -> PBool -- test if any char occurs
    -  show   : (P:Type) -> P ->Tok -- param to string
    -  read   : (P:Type) -> Tok-> P -- string to param
    -  toStr  : (L:Type) -> L ->Str -- find "first" string
    -  
    -  -- lib/prelude/Prelude.gf
    -  param Bool = True | False
    -  oper
    -    SS  : Type                   -- the type {s : Str}
    -    ss  : Str -> SS              -- construct SS
    -    cc2 : (_,_ : SS) -> SS       -- concat SS's
    -    optStr : Str -> Str          -- string or empty
    -    strOpt : Str -> Str          -- empty or string
    -    bothWays : Str -> Str -> Str -- X++Y or Y++X 
    -    init : Tok -> Tok            -- all but last char
    -    last : Tok -> Tok            -- last char
    -    prefixSS : Str -> SS -> SS
    -    postfixSS : Str -> SS -> SS
    -    infixSS : Str -> SS -> SS -> SS
    -    if_then_else : (A : Type) -> Bool -> A -> A -> A
    -    if_then_Str : Bool -> Str -> Str -> Str
    -
    - - -

    Flags

    - -

    -Flags can appear, with growing priority, -

    - -
      -
    • in files, judgement flags and without dash (-) -
    • as flags to gf when invoked, with dash -
    • as flags to various GF commands, with dash -
    - -

    -Some common flags used in grammars: -

    - -
    -  startcat=cat    use this category as default 
    -  
    -  lexer=literals  int and string literals recognized
    -  lexer=code      like program code
    -  lexer=text      like text: spacing, capitals
    -  lexer=textlit   text, unknowns as string lits
    -  
    -  unlexer=code    like program code
    -  unlexer=codelit code, remove string lit quotes
    -  unlexer=text    like text: punctuation, capitals
    -  unlexer=textlit text, remove string lit quotes
    -  unlexer=concat  remove all spaces
    -  unlexer=bind    remove spaces around "&+"
    -  
    -  optimize=all_subs  best for almost any concrete
    -  optimize=values    good for lexicon concrete
    -  optimize=all       usually good for resource
    -  optimize=noexpand  for resource, if =all too big
    -
    - -

    -For the full set of values for FLAG, -use on-line h -FLAG. -

    - - -

    File paths

    - -

    -Colon-separated lists of directories searched in the -given order: -

    - -
    -  --# -path=.:../abstract:../common:prelude
    -
    - -

    -This can be (in order of growing preference), as -first line in the top file, as flag to gf -when invoked, or as flag to the i command. -The prefix --# is used only in files. -

    -

    -If the environment variabls GF_LIB_PATH is defined, its -value is automatically prefixed to each directory to -extend the original search path. -

    - - -

    Alternative grammar formats

    - -

    -Old GF (before GF 2.0): -all judgements in any kinds of modules, -division into files uses includes. -A file Foo.gf is recognized as the old format -if it lacks a module header. -

    -

    -Context-free (file foo.cf). The form of rules is e.g. -

    - -
    -  Fun. S ::= NP "is" AP ;
    -
    - -

    -If Fun is omitted, it is generated automatically. -Rules must be one per line. The RHS can be empty. -

    -

    -Extended BNF (file foo.ebnf). The form of rules is e.g. -

    - -
    -  S ::= (NP+ ("is" | "was") AP | V NP*) ;
    -
    - -

    -where the RHS is a regular expression of categories -and quoted tokens: "foo", CAT, T U, T|U, T*, T+, T?, or empty. -Rule labels are generated automatically. -

    -

    -Probabilistic grammars (not a separate format). -You can set the probability of a function f (in its value category) by -

    - -
    -  --# prob f 0.009
    -
    - -

    -These are put into a file given to GF using the probs=File flag -on command line. This file can be the grammar file itself. -

    -

    -Example-based grammars (file foo.gfe). Expressions of the form -

    - -
    -  in Cat "example string"
    -
    - -

    -are preprocessed by using a parser given by the flag -

    - -
    -  --# -resource=File
    -
    - -

    -and the result is written to foo.gf. -

    - - -

    References

    - -

    -GF Homepage -

    -

    -A. Ranta, Grammatical Framework: A Type-Theoretical Grammar Formalism. -The Journal of Functional Programming, vol. 14:2. 2004, pp. 145-189. -

    - - - - diff --git a/download/index-3.1.6.html b/download/index-3.1.6.html deleted file mode 100644 index f351fbb1e..000000000 --- a/download/index-3.1.6.html +++ /dev/null @@ -1,93 +0,0 @@ - - - - -Grammatical Framework Download and Installation - -

    Grammatical Framework Download and Installation

    - -Version 3.1.6, 23 April 2010
    -
    - -

    Latest developer code

    -

    -GF darcs repository -

    -

    Latest release

    -

    -GF 3.1.6 released 23 April 2010. -

    - - -

    -What's new? See the release notes. -

    -

    Previous releases

    -

    -Follow this link. -

    -

    Installation instructions

    -

    -The Windows package is installed by just unpacking it anywhere. -It finds the libraries relative to the .exe file. -

    -

    -To install a binary package for MacOS X or Linux: uncompress the executable and -put it somewhere on your path, renaming it to just gf. For instance: -

    -
    -    gunzip gf-bin-[version].gz
    -    sudo mv gf-bin-[version] /usr/local/bin/gf
    -
    -

    -To install the libraries (if done separately), unpack them in the place to which your -GF_LIB_PATH points. -

    -
    -    cd $GF_LIB_PATH
    -    gtar xvfz gf-lib-[VERSION].tgz
    -
    -

    -If this variable hasn't been defined, it is useful define it, e.g. -

    -
    -    export GF_LIB_PATH=/usr/local/lib/gf/
    -
    -

    -

    -To compile and install from source on Mac or Linux, do: -

    -
    -    tar xvfz gf-[VERSION].tgz
    -    cd GF/src
    -    runghc Setup configure --user
    -    runghc Setup build
    -    runghc Setup install
    -
    -

    -The last command must be prefixed by sudo, if the installation is outside -user-writeable area. -

    - - - - diff --git a/download/release-3.1.6.html b/download/release-3.1.6.html deleted file mode 100644 index e7c31458d..000000000 --- a/download/release-3.1.6.html +++ /dev/null @@ -1,87 +0,0 @@ - - - - -GF Version 3.1.6 Release Notes - -

    GF Version 3.1.6 Release Notes

    - -23 April 2010
    -
    - -

    Installation

    -

    -The binaries now work out of the box for each platform and support -completions (file names and parsing), because readline has been -changed to haskeline. -

    -

    -To compile from source, GHC 6.12 is now required. But GHC is not needed -if the binary executables are used. -

    -

    -Binaries (.gfo and .pgf files) compiled with GF 3.1 are incompatible -with 3.1.6 and must either be removed; alternatively, the -src flag can be -used when compiling. -

    -

    -Notice the new place to send bug reports (see GF's welcome message)! -

    -

    New features

    -

    -Grammar language -

    -
      -
    • improved support for dependent types (see SUMO, nqueens in examples) -
    - -

    -Shell commands and options (see help in GF for more information) -

    -
      -
    • eb: example-based grammar file conversion - (see examples/animals/QuestionI.gf) -
    • vd = visualize_dependency: show dependency tree -
    • vp = visualize_parse: show parse tree -
    • gr, gt, mq, tq: use a seed tree with metavariables -
    • gr, p, tq: use -probs=FILE to bias or rank generated trees -
    • gt now tries the different alternatives in the order in which they appear in the source code -
    • dg: hide modules when printing dependency graph -
    • -output-format=lambda_prolog let us to use Lambda Prolog for exhaustive generation with dependent types -
    - -

    -Libraries -

    -
      -
    • Urdu completed (Shafqat Virk) -
    • Turkish morphology + Zamberek's dictionary in GF (Server Cimen) -
    - -

    -Examples -

    -
      -
    • SUMO -
    • phrasebook -
    • nqueens -
    - -

    -Internal -

    -
      -
    • single PMCFG format for both linearization and parsing -
    • use of Haskeline for completion - more portable than Readline -
    • unicode support from Haskell 6.12 instead of home-made coding -
    - -

    Issues

    -

    -Javascript generation is not updated to the new PGF format. -GF 3.1 should still be used for building Javascript applications. -

    - - - - diff --git a/download/release-3.1.6.txt b/download/release-3.1.6.t2t similarity index 100% rename from download/release-3.1.6.txt rename to download/release-3.1.6.t2t diff --git a/gf-book/index.html b/gf-book/index.html deleted file mode 100644 index 00a0f7afe..000000000 --- a/gf-book/index.html +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - -Grammatical Framework: Programming with Multilingual Grammars - -
    -

    Grammatical Framework: Programming with Multilingual Grammars

    -Aarne Ranta
    -
    - -

    -

    -

    -

    -This is the web page of the book -

    - -
      -
    • Aarne Ranta, - Grammatical Framework: Programming with Multilingual Grammars, - CSLI Publications, - Stanford, - 2011, - 340 pp, - ISBN-10: 1-57586-626-9 (Paper), 1-57586-627-7 (Cloth). -
    - -

    Publisher's information

    - -

    -Publisher's web page (look for "Series" -> "CSLI Studies in Computational Linguistics") -

    -

    - http://www-csli.stanford.edu/pubs/ -

    - -

    Order

    - -

    -Direct order ($32.50 paperback, $70 hardcover): -

    -

    - http://press.uchicago.edu/ucp/books/book/distributed/G/bo12469871.html -

    -

    -Amazon order USA ($32.50 paperback, $70 hardcover): -

    -

    - http://www.amazon.com/Grammatical-Framework-Programming-Multilingual-Information/dp/1575866269/ref=sr_1_2?ie=UTF8&qid=1308585697&sr=8-2 -

    -

    -Amazon order UK (£21 paperback, £45 hardcover): -

    -

    - http://www.amazon.co.uk/Grammatical-Framework-Programming-Multilingual-Computational/dp/1575866269/ref=sr_1_6?ie=UTF8&qid=1315580083&sr=8-6 -

    - -

    Book description

    - -

    -Grammars of natural languages are complex systems, and their -computer implementation requires both programming skills and -linguistic knowledge, especially when dealing with other languages -than English. This book makes such tasks accessible for a wide -range of programmers. It introduces GF (Grammatical Framework), -which is a programming language designed for writing grammars, which -may moreover address several languages in parallel. -The book shows how to write grammars in GF and use them in applications -such as tourist phrasebooks, spoken dialogue systems, and natural -language interfaces. The examples and exercises address several -languages, and the readers are guided to look at their own languages -from the computational perspective. -

    -

    -With an emphasis on good engineering, the book promotes modularity -and division of labour - in particular, the use of libraries. It -introduces the GF Resource Grammar Library, which currently addresses -16 languages. This number is constantly growing due to contributions -from the international GF community. The library makes it painless to -build applications and to port them to new languages. The book -introduces a wide range of such applications, which run on platforms -ranging from web servers to mobile phones. But the book also gives -guidance for those readers who want to understand the underlying -linguistics and implement resource grammars for new languages. -

    -

    -The book starts with a hands-on tutorial, continues with a selection -of advanced topics, and ends with a complete reference manual -of GF. Requiring very little background knowledge, it is accessible -for second-year students that have experience with computers and an -interest for languages. At the same time, its novel and advanced -material makes it interesting for senior researchers in computer science, -linguistics, and related fields. -

    - -

    How to cite

    - -
    -  @Book{ranta-2011,
    -    author = {Aarne Ranta},
    -    title =  {{Grammatical Framework:
    -               Programming with Multilingual Grammars}},
    -    publisher = {{CSLI Publications}},
    -    year = {2011},
    -    address = "Stanford",
    -    note = "ISBN-10: 1-57586-626-9 (Paper), 1-57586-627-7 (Cloth)"
    -  }
    -
    - -

    Table of Contents

    - -

    -Detailed Table of Contents -

    - -

    Supporting material

    - -

    -Slides for teaching the book chapter by chapter. -

    -

    -Code examples. You can also download the -complete example set as a compressed tar file, -gf-book-examples.tgz. -

    -

    -GF Web IDE: -build grammars in the cloud, without installing GF. -

    -

    -Demos -

    - - - -

    -Other tutorials: -

    - - - -

    -Works mentioned in references; -more download links will be added. -

    -

    -Resource Grammar Library API -

    -

    -Sources and binaries -for GF 3.2, which exactly matches the book. -

    -

    -GF Home Page: http://www.grammaticalframework.org/ -

    -

    -Author's email: aarne'at'chalmers'dot'se -

    -

    -Author's home page: http://www.cse.chalmers.se/~aarne/ -

    - - - - diff --git a/gf-book/index.txt b/gf-book/index.t2t similarity index 100% rename from gf-book/index.txt rename to gf-book/index.t2t From 013f3573e6d310e6f00cf3cdeeaa15ab46855e24 Mon Sep 17 00:00:00 2001 From: Aarne Ranta Date: Tue, 12 Jun 2018 20:39:39 +0200 Subject: [PATCH 07/19] added transliteration arabic_unvocalized, which omits the vowels --- src/compiler/GF/Text/Transliterations.hs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/compiler/GF/Text/Transliterations.hs b/src/compiler/GF/Text/Transliterations.hs index 7645fc158..9b1b6e151 100644 --- a/src/compiler/GF/Text/Transliterations.hs +++ b/src/compiler/GF/Text/Transliterations.hs @@ -39,6 +39,7 @@ allTransliterations = Map.fromList [ ("amharic",transAmharic), ("ancientgreek", transAncientGreek), ("arabic", transArabic), + ("arabic_unvocalized", transArabicUnvoc), ("devanagari", transDevanagari), ("greek", transGreek), ("hebrew", transHebrew), @@ -178,6 +179,13 @@ transArabic = mkTransliteration "Arabic" allTrans allCodes where allCodes = [0x0621..0x062f] ++ [0x0630..0x063a] ++ [0x0641..0x064f] ++ [0x0650..0x0657] ++ [0x0671,0x061f] + +transArabicUnvoc :: Transliteration +transArabicUnvoc = transArabic{ + invisible_chars = ["a","u","i","v2","o","V+","V-","a:"], + printname = "unvocalized Arabic" + } + transPersian :: Transliteration transPersian = (mkTransliteration "Persian/Farsi" allTrans allCodes) {invisible_chars = ["a","u","i"]} where From 22b754d23b56189cf2e7a35096ecd4562ec4093f Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 13 Jun 2018 08:47:33 +0200 Subject: [PATCH 08/19] Clean up old download pages --- download.html | 54 ------------ download/old-index.html | 146 -------------------------------- examples/{READ_ME => README.md} | 4 +- 3 files changed, 3 insertions(+), 201 deletions(-) delete mode 100644 download.html delete mode 100644 download/old-index.html rename examples/{READ_ME => README.md} (93%) diff --git a/download.html b/download.html deleted file mode 100644 index 5da03ea53..000000000 --- a/download.html +++ /dev/null @@ -1,54 +0,0 @@ - - - -GF Version 2.8, released 8 July 2007; updated 12 September. -
      -
    • GF-2.8.tgz, -Haskell and Java sources, grammar library sources, examples, documentation. -To compile and install: read src/INSTALL. - -
    • GF-2.8-lib.tgz, -Compiled grammar libraries. To install: -unpack this in the directory pointed by GF_LIB_PATH. - -
    • GF-2.8-i386-pc-linux-gnu.tgz, -Linux binary, with precompiled grammar libraries. To install: -
      -  tar xvfz GF-2.8-i386-pc-linux-gnu.tgz
      -  cd GF-2.8-i386-pc-linux-gnu
      -  ./configure
      -  make install
      -
      -You may need sudo make install; if you cannot write in -/usr/local/, you can change the target directory -by ./configure --prefix=MYDIR. - - -
    • GF-2.8-i386-apple-darwin8.9.1.tgz, Mac OS X binary (Intel), with precompiled grammar libraries. Requires Readline from -MacPorts. To install, see above item. - -
    • GF-2.8-windows-cygwin.tgz, Windows Cygwin binary. Requires -Cygwin. To install, see above item. - -
    -The Sourceforge GF site -has currently only v 2.7 and older versions. - -

    - -Don't forget that you can always get the current sources from the -GF Darcs Repository. First time you do -

    -  darcs get --partial --set-scripts-executable http://www.cs.chalmers.se/Cs/Research/Language-technology/darcs/GF/
    -
    -and subsequent times -
    -  darcs pull -a
    -
    -Then compile and install as described in -GF/src/INSTALL. - - - - diff --git a/download/old-index.html b/download/old-index.html deleted file mode 100644 index 74dabb08c..000000000 --- a/download/old-index.html +++ /dev/null @@ -1,146 +0,0 @@ - - - - -Grammatical Framework Download and Installation - - - - -

    Grammatical Framework
    Download and Installation

    - -

    Latest developer code

    -

    -GF darcs repository -

    - -

    Latest release

    - -
    -
    GF 3.1, 15 December 2009 -
    -

    -

    - -

    Installation instructions

    - -
      -
    • Linux & Mac binaries: tar xvfz in / -
    • Windows binary: unzip in c:\ -
    • Compiled library: - tar xvfz in some DIR and point the variable GF_LIB_PATH to DIR/lib. -
    • -Source package: tar xvfz somewhere and compile as follows: -

      -

      -    tar xvfz gf-3.0.tgz
      -    cd gf-3.0
      -
      -    # alternative 1:
      -    runghc Setup configure
      -    runghc Setup build
      -    runghc Setup install
      -
      -    # alternative 2:
      -    make
      -    make install
      -
      -
    - -

    Old releases

    - -
    -
    GF 3.0, 24 June 2009. -
    -

    -

    - -

    Installation instructions

    - -

    -Mac binary: gunzip and put somewhere on your path. -

    -Linux: tar xvfz in / -

    -Windows: unzip in c:\ -

    -Compiled library: tar xvfz in some DIR and point the variable GF_LIB_PATH to DIR/lib. -

    -Source package: tar xvfz somewhere and compile as follows: -

    -

    -    tar xvfz gf-3.0.tgz
    -    cd gf-3.0
    -
    -    # alternative 1:
    -    runghc Setup configure
    -    runghc Setup build
    -    runghc Setup install
    -
    -    # alternative 2:
    -    make
    -    make install
    -
    -
    - - -GF 3.0 beta3, April 2009. - -3.0 beta2 - - - - - - diff --git a/examples/READ_ME b/examples/README.md similarity index 93% rename from examples/READ_ME rename to examples/README.md index 1c86317fa..e073602ab 100644 --- a/examples/READ_ME +++ b/examples/README.md @@ -1,3 +1,5 @@ +# `/examples` + All contributions (`contrib` and `examples` folders) have now been moved to a separate git repository at: @@ -10,5 +12,5 @@ have some toy grammars to play with. Any updates to these grammars should be made at the gf-contrib repository above; changes will be copied from there to here manually. -John J. Camilleri +John J. Camilleri, 2013-09-16 From 4ca52bf7634f4df17207eeb3216e02c88558dfd5 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 13 Jun 2018 09:52:20 +0200 Subject: [PATCH 09/19] Add TypeScript type definitions for gflib.js --- src/runtime/typescript/gflib.d.ts | 337 ++++++++++++++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 src/runtime/typescript/gflib.d.ts diff --git a/src/runtime/typescript/gflib.d.ts b/src/runtime/typescript/gflib.d.ts new file mode 100644 index 000000000..4249e66d2 --- /dev/null +++ b/src/runtime/typescript/gflib.d.ts @@ -0,0 +1,337 @@ +/** + * gflib.dt.s + * + * by John J. Camilleri + * + * TypeScript type definitions for the "original" JS GF runtime (GF:src/runtime/javascript/gflib.js) + */ + +// Note: the String prototype is extended with: +// String.prototype.tag = ""; +// String.prototype.setTag = function (tag) { this.tag = tag; }; + +/** + * A GF grammar is one abstract and multiple concretes + */ +declare class GFGrammar { + abstract: GFAbstract + concretes: {[key: string]: GFConcrete} + + constructor(abstract: GFAbstract, concretes: {[key: string]: GFConcrete}) + + translate( + input: string, + fromLang: string, + toLang: string + ): {[key: string]: {[key: string]: string}} +} + +/** + * Abstract Syntax Tree + */ +declare class Fun { + name: string + args: Fun[] + + constructor(name: string, ...args: Fun[]) + + print(): string + show(): string + getArg(i: number): Fun + setArg(i: number, c: Fun): void + isMeta(): boolean + isComplete(): boolean + isLiteral(): boolean + isString(): boolean + isInt(): boolean + isFloat(): boolean + isEqual(obj: any): boolean +} + +/** + * Abstract syntax + */ +declare class GFAbstract { + startcat: string + types: {[key: string]: Type} // key is function name + + constructor(startcat: string, types: {[key: string]: Type}) + + addType(fun: string, args: string[], cat: string): void + getArgs(fun: string): string[] + getCat(fun: string): string + annotate(tree: Fun, type: string): Fun + handleLiterals(tree: Fun, type: Type): Fun + copyTree(x: Fun): Fun + parseTree(str: string, type: string): Fun + parseTree_(tokens: string[], prec: number): Fun +} + +/** + * Type + */ +declare class Type { + args: string[] + cat: string + + constructor(args: string[], cat: string) +} + +type ApplyOrCoerce = Apply | Coerce + +/** + * Concrete syntax + */ +declare class GFConcrete { + flags: {[key: string]: string} + productions: {[key: number]: ApplyOrCoerce[]} + functions: CncFun[] + sequences: Array> + startCats: {[key: string]: {s: number, e: number}} + totalFIds: number + pproductions: {[key: number]: ApplyOrCoerce[]} + lproductions: {[key: string]: {fid: FId, fun: CncFun}} + + constructor( + flags: {[key: string]: string}, + productions: {[key: number]: ApplyOrCoerce[]}, + functions: CncFun[], + sequences: Array>, + startCats: {[key: string]: {s: number, e: number}}, + totalFIds: number + ) + + linearizeSyms(tree: Fun, tag: string): Array<{fid: FId, table: any}> + syms2toks(syms: Sym[]): string[] + linearizeAll(tree: Fun): string[] + linearize(tree: Fun): string + tagAndLinearize(tree: Fun): string[] + unlex(ts: string): string + tagIt(obj: any, tag: string): any + // showRules(): string // Uncaught TypeError: Cannot read property 'length' of undefined at gflib.js:451 + tokenize(string: string): string[] + parseString(string: string, cat: string): Fun[] + complete( + input: string, + cat: string + ): {consumed: string[], suggestions: string[]} +} + +/** + * Function ID + */ +type FId = number + +/** + * Apply + */ +declare class Apply { + id: string + fun: FId + args: PArg[] + + constructor(fun: FId, args: PArg[]) + + show(cat: string): string + isEqual(obj: any): boolean +} + +/** + * PArg + */ +declare class PArg { + fid: FId + hypos: any[] + + constructor(fid: FId, ...hypos: any[]) +} + +/** + * Coerce + */ +declare class Coerce { + id: string + arg: FId + + constructor(arg: FId) + + show(cat: string): string +} + +/** + * Const + */ +declare class Const { + id: string + lit: Fun + toks: any[] + + constructor(lit: Fun, toks: any[]) + + show(cat: string): string + isEqual(obj: any): boolean +} + +/** + * CncFun + */ +declare class CncFun { + name: string + lins: FId[] + + constructor(name: string, lins: FId[]) +} + +type Sym = SymCat | SymKS | SymKP | SymLit + +/** + * SymCat + */ +declare class SymCat { + id: string + i: number + label: number + + constructor(i: number, label: number) + + getId(): string + getArgNum(): number + show(): string +} + +/** + * SymKS + */ +declare class SymKS { + id: string + tokens: string[] + + constructor(...tokens: string[]) + + getId(): string + show(): string +} + +/** + * SymKP + */ +declare class SymKP { + id: string + tokens: string[] + alts: Alt[] + + constructor(tokens: string[], alts: Alt[]) + + getId(): string + show(): string +} + +/** + * Alt + */ +declare class Alt { + tokens: string[] + prefixes: string[] + + constructor(tokens: string[], prefixes: string[]) +} + +/** + * SymLit + */ +declare class SymLit { + id: string + i: number + label: number + + constructor(i: number, label: number) + + getId(): string + show(): string +} + +/** + * Trie + */ +declare class Trie { + value: any + items: Trie[] + + insertChain(keys, obj): void + insertChain1(keys, obj): void + lookup(key, obj): any + isEmpty(): boolean +} + +/** + * ParseState + */ +declare class ParseState { + concrete: GFConcrete + startCat: string + items: Trie + chart: Chart + + constructor(concrete: GFConcrete, startCat: string) + + next(token: string): boolean + complete(correntToken: string): Trie + extractTrees(): any[] + process( + agenda, + literalCallback: (fid: FId) => any, + tokenCallback: (tokens: string[], item: any) => any + ): void +} + +/** + * Chart + */ +declare class Chart { + active: any + actives: {[key: number]: any} + passive: any + forest: {[key: number]: ApplyOrCoerce[]} + nextId: number + offset: number + + constructor(concrete: GFConcrete) + + lookupAC(fid: FId,label) + lookupACo(offset, fid: FId, label) + + labelsAC(fid: FId) + insertAC(fid: FId, label, items): void + + lookupPC(fid: FId, label, offset) + insertPC(fid1: FId, label, offset, fid2: FId): void + shift(): void + expandForest(fid: FId): any[] +} + +/** + * ActiveItem + */ +declare class ActiveItem { + offset: number + dot: number + fun: CncFun + seq: Array + args: PArg[] + fid: FId + lbl: number + + constructor( + offset: number, + dot: number, + fun: CncFun, + seq: Array, + args: PArg[], + fid: FId, + lbl: number + ) + + isEqual(obj: any): boolean + shiftOverArg(i: number, fid: FId): ActiveItem + shiftOverTokn(): ActiveItem +} From f0c5d53e78cf998dbe0b4b25cb0b3dfccb65f54b Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Wed, 13 Jun 2018 10:18:25 +0200 Subject: [PATCH 10/19] Remove editor mode files from Haskell package (in gf.cabal) --- gf.cabal | 55 ++++++++++++++++++++++++++----------------------------- 1 file changed, 26 insertions(+), 29 deletions(-) diff --git a/gf.cabal b/gf.cabal index 540a54197..54661ea13 100644 --- a/gf.cabal +++ b/gf.cabal @@ -14,33 +14,30 @@ maintainer: Thomas Hallgren tested-with: GHC==7.6.3, GHC==7.8.3, GHC==7.10.3, GHC==8.0.2 data-dir: src -data-files: tools/gf.el - tools/gf.lang - tools/dark-filetypes.GF.conf - tools/light-filetypes.GF.conf - www/*.html - www/*.css - www/P/*.png - www/gfse/*.html - www/gfse/*.css - www/gfse/*.js - www/gfse/P/*.png - www/gfse/P/*.jpg - www/js/*.js - www/minibar/*.html - www/minibar/*.css - www/minibar/*.js - www/minibar/*.png - www/syntax-editor/*.html - www/syntax-editor/*.css - www/syntax-editor/*.js - www/TransQuiz/*.html - www/TransQuiz/*.css - www/TransQuiz/*.js - www/TransQuiz/*.png - www/translator/*.html - www/translator/*.css - www/translator/*.js +data-files: + www/*.html + www/*.css + www/P/*.png + www/gfse/*.html + www/gfse/*.css + www/gfse/*.js + www/gfse/P/*.png + www/gfse/P/*.jpg + www/js/*.js + www/minibar/*.html + www/minibar/*.css + www/minibar/*.js + www/minibar/*.png + www/syntax-editor/*.html + www/syntax-editor/*.css + www/syntax-editor/*.js + www/TransQuiz/*.html + www/TransQuiz/*.css + www/TransQuiz/*.js + www/TransQuiz/*.png + www/translator/*.html + www/translator/*.css + www/translator/*.js --source-repository head -- type: darcs @@ -104,9 +101,9 @@ Library --if impl(ghc>=7.8) -- ghc-options: +RTS -A20M -RTS ghc-prof-options: -fprof-auto - extensions: + extensions: - exposed-modules: + exposed-modules: PGF PGF.Internal PGF.Haskell From 71c7fbc7f900a7a3479426d5ee064cd9c6cd2072 Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Thu, 14 Jun 2018 10:11:11 +0200 Subject: [PATCH 11/19] Remove oldstyle.css --- css/oldstyle.css | 43 ------------------------------------------- css/style0.css | 6 ++++-- index.html | 4 +--- 3 files changed, 5 insertions(+), 48 deletions(-) delete mode 100644 css/oldstyle.css diff --git a/css/oldstyle.css b/css/oldstyle.css deleted file mode 100644 index fcc422975..000000000 --- a/css/oldstyle.css +++ /dev/null @@ -1,43 +0,0 @@ - -/* Found it at http://article.olduse.net/771@mit-eddie.UUCP */ -@font-face { - font-family: GlassTTYVT220; - src: local("Glass TTY VT220"), local("Glass TTY VT220 Medium"), url(/font/Glass_TTY_VT220.ttf) format("truetype"); -} - -body { - font-size: 20px; - font-family: GlassTTYVT220; - color: #e5b800; - background-color: #0a0600; -} - -h1,h2,h3,h4 { font-size: 20px; } - -img.logo, img.grow { display: none; } - -a { color: #ecc800; } -a:hover { color: #fcd800; } - -div.links { - display: inline-block; - vertical-align: top; - margin-right: 1em; -} - -table.news td { - background: inherit; - border: 0; - vertical-align: baseline; - padding: 0.25ex 0.5ex; -} - -table.news td:nth-child(1) { - /* Don't want the hyphens in dates (2012-06-29) to cause line breaks */ - white-space: nowrap; -} - -ol.languages { - column-width: 12em; - -moz-column-width: 12em; -} diff --git a/css/style0.css b/css/style0.css index 6e5500a17..3c53c5378 100644 --- a/css/style0.css +++ b/css/style0.css @@ -17,8 +17,10 @@ h1 img.nofloat { float: none; } img.right { float: right; } ol.languages { - column-width: 12em; - -moz-column-width: 12em; + display: flex; + flex-direction: column; + flex-wrap: wrap; + height: 12em; } .grow { diff --git a/index.html b/index.html index c6d96a6bf..f00aaabee 100644 --- a/index.html +++ b/index.html @@ -4,9 +4,7 @@ GF - Grammatical Framework - - - +